mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
logging: leap-year issue. without a year, strptime() doesn't seem to assume it's this year.
This commit is contained in:
parent
212e9527c3
commit
c104582ed7
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user