diff options
Diffstat (limited to 'py/log_parser.py')
-rw-r--r-- | py/log_parser.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/py/log_parser.py b/py/log_parser.py index f5c4eb5..eb081a9 100644 --- a/py/log_parser.py +++ b/py/log_parser.py @@ -5,7 +5,6 @@ import sys from multiprocessing import Pool, cpu_count import re import io -import gzip import json import os from sqlalchemy.ext.declarative import declarative_base @@ -138,9 +137,13 @@ def runLogParser(args): log_search_pattern = get_log_search_pattern(Session, args.uuid, config['default_uuid']) Session.close() # read the log file to dict - for text_line in io.TextIOWrapper(io.BufferedReader(gzip.open(args.file)), encoding='utf8', errors='ignore'): - logfile_text_dict[index] = text_line.strip('\n') - index = index + 1 + with open(args.file, encoding='utf8', errors='ignore') as f: + for text_line in f: + logfile_text_dict[index] = text_line.strip('\n') + index = index + 1 + #for text_line in io.TextIOWrapper(io.BufferedReader(open(args.file)), encoding='utf8', errors='ignore'): + # logfile_text_dict[index] = text_line.strip('\n') + # index = index + 1 # run the search parse pattern on the text lines #params = [(log_search_pattern, text, line_index,) for line_index, text in logfile_text_dict.items()] with getMultiprocessingPool(config) as pool: |