From c104582ed77ffcabdedec5323385cadd656526b4 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sat, 29 Feb 2020 17:23:10 +0100 Subject: [PATCH] logging: leap-year issue. without a year, strptime() doesn't seem to assume it's this year. --- src/opnsense/scripts/systemhealth/logformats/syslog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/scripts/systemhealth/logformats/syslog.py b/src/opnsense/scripts/systemhealth/logformats/syslog.py index 7f2a74e39..02243015b 100755 --- a/src/opnsense/scripts/systemhealth/logformats/syslog.py +++ b/src/opnsense/scripts/systemhealth/logformats/syslog.py @@ -39,7 +39,7 @@ class SysLogFormat(BaseLogFormat): def timestamp(self, line): # syslog format, strip timestamp and return actual log data - ts = datetime.datetime.strptime(line[0:15], "%b %d %H:%M:%S") + ts = datetime.datetime.strptime("%s %s" % (self._startup_timestamp.year, line[0:15]), "%Y %b %d %H:%M:%S") ts = ts.replace(year=self._startup_timestamp.year) if (self._startup_timestamp - ts).days < 0: # likely previous year, (month for this year not reached yet)