Skip to content

Instantly share code, notes, and snippets.

@DerekHawkins
Created July 28, 2021 17:43
Show Gist options
  • Save DerekHawkins/4c8bda582a39eff6b0579bb842c02034 to your computer and use it in GitHub Desktop.
Save DerekHawkins/4c8bda582a39eff6b0579bb842c02034 to your computer and use it in GitHub Desktop.
# Approach takes into consideration multiple log files stored locally with a .gz format
log_file_slugs = os.listdir(r'C:\Users\Derek.Hawkins\Log File Analysis Folder')
log_file_slugs = [x for x in log_file_slugs if '.gz' in x]
main = []
for i in log_file_slugs:
with gzip.open(r'C:\Users\Derek.Hawkins\Log File Analysis\{}'.format(i),'r') as fin:
for line in tqdm(fin):
try:
main.append(log_parse(line.decode()))
except AttributeError as e:
print(line.decode())
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment