2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-11-02 04:12:33 +00:00

Merge pull request #182 from tkucherera-lenovo/eventlog

handle empty timestample
This commit is contained in:
Jarrod Johnson
2025-03-13 10:22:39 -04:00
committed by GitHub

View File

@@ -78,8 +78,11 @@ exitcode = 0
def format_event(evt):
retparts = []
if 'timestamp' in evt and evt['timestamp'] is not None:
display = dt.strptime(evt['timestamp'], '%Y-%m-%dT%H:%M:%S')
retparts.append(display.strftime('%m/%d/%Y %H:%M:%S'))
try:
display = dt.strptime(evt['timestamp'], '%Y-%m-%dT%H:%M:%S')
retparts.append(display.strftime('%m/%d/%Y %H:%M:%S'))
except ValueError:
display = ''
dscparts = []
if evt.get('log_id', None):
retparts.append(evt['log_id'] + ':')