Don't crash if we can't parse lines.. This shouldn't happen often, but may or may not happen, no reason to get the pants in a twist..
This commit is contained in:
@@ -144,7 +144,11 @@ def parse_line(input_line: str) -> dict:
|
|||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return None
|
return None
|
||||||
logline_time = datetime.strptime(str(now.year) + ' ' + month + ' ' + str(dateint) + ' ' + str(timestr), '%Y %b %d %H:%M:%S')
|
try:
|
||||||
|
logline_time = datetime.strptime(str(now.year) + ' ' + month + ' ' + str(dateint) + ' ' + str(timestr), '%Y %b %d %H:%M:%S')
|
||||||
|
except ValueError:
|
||||||
|
logging.error('Could not parse line ' + str(input_line))
|
||||||
|
return None
|
||||||
#If this is in the future, this probably means the data is from last year
|
#If this is in the future, this probably means the data is from last year
|
||||||
if logline_time > now:
|
if logline_time > now:
|
||||||
#We're in the future. Prettu sure the future is not yet, we're in last year
|
#We're in the future. Prettu sure the future is not yet, we're in last year
|
||||||
|
|||||||
Reference in New Issue
Block a user