Skip to content

Instantly share code, notes, and snippets.

@michaeldorner
Created April 6, 2023 09:27
Show Gist options
  • Save michaeldorner/7f8e6d5c5d4d6df7a2a317137ad3799e to your computer and use it in GitHub Desktop.
Save michaeldorner/7f8e6d5c5d4d6df7a2a317137ad3799e to your computer and use it in GitHub Desktop.
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