Merge "swift-drive-audit: Work with ISO timestamps"

This commit is contained in:
Zuul 2024-07-22 18:19:46 +00:00 committed by Gerrit Code Review
commit 533a601cbf

View File

@ -147,7 +147,12 @@ def get_errors(error_re, log_file_pattern, minutes, logger,
log_time = datetime.datetime.strptime( log_time = datetime.datetime.strptime(
log_time_string, '%Y %b %d %H:%M:%S') log_time_string, '%Y %b %d %H:%M:%S')
except ValueError: except ValueError:
continue # Some versions use ISO timestamps instead
try:
log_time = datetime.datetime.strptime(
line[0:19], '%Y-%m-%dT%H:%M:%S')
except ValueError:
continue
if log_time > end_time: if log_time > end_time:
for err in error_re: for err in error_re:
for device in err.findall(line): for device in err.findall(line):