Last active
March 18, 2024 02:12
-
-
Save fanyang89/e044b4b5bc4ad97df59787788198f9b9 to your computer and use it in GitHub Desktop.
ZooKeeper log filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import in_place | |
def main(): | |
log_paths = glob.glob("**/zookeeper*log*", recursive=True) | |
for path in log_paths: | |
print(f"processing log file {path}") | |
with in_place.InPlace(path) as fp: | |
for line in fp: | |
if "- Stat command output" in line: | |
continue | |
if "- Processing stat command from " in line: | |
continue | |
if "- Processing ruok command from" in line: | |
continue | |
fp.write(line) | |
print(f"processing log file {path} done") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python3 -m pip install in_place