Created
April 6, 2023 09:27
-
-
Save michaeldorner/7f8e6d5c5d4d6df7a2a317137ad3799e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from pathlib import Path | |
lines_not_200 = [] | |
log_file_dir = '.' | |
for log_file in Path(log_file_dir).glob('*.log'): | |
with open(log_file, 'r') as f: | |
for line in f.readlines(): | |
if not line.startswith('INFO:root:HTTP status 200'): | |
lines_not_200 += [line] | |
with open('./cleared_logs.txt', 'w') as f: | |
for line in lines_not_200: | |
f.write(f'{line}\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment