Commit 6ee47119 authored by thomas.forbriger's avatar thomas.forbriger Committed by Checksum Backup @bromo
Browse files

csbackntfy: catch parsing error in date section of log line

parent 6aa17505
......@@ -46,6 +46,7 @@
# 01/09/2014 V0.9 (thof) use local mail transfer agent
# 02/08/2019 V0.10 (thof) print reasonable error meassage if non of the
# message level keywords is found
# (thof) catch parsing error in date section of log line
# =============================================================================
......@@ -271,8 +272,13 @@ def main(argv=None):
for path in logFilePathes:
for line in open(path, 'r').readlines():
# extract timestamp from log message
timeStamp=dt.datetime.strptime(str(now.year)+" "+" ".join(str(n) \
timeStamp=dt.datetime.strptime(str(now.year)+" "+" ".join(str(n)
for n in line.split()[0:3]),"%Y %b %d %H:%M:%S")
raise Error(("Error while parsing log line\n %s\n"
+" from file %s") % (line, path),
if 'CRITICAL' in line:
if timeStamp > timeLimit:
criticalList.append("logfile: "+path+"\n"+line)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment