2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 02:52:07 +00:00

nodeeventlog: timeframe option

This commit is contained in:
Tinashe 2023-01-26 10:16:33 -05:00
parent 7a6c4fc5b2
commit 3433635e9b

View File

@ -163,5 +163,9 @@ if options.lines:
evtdata_list = evtdata_list[-abs(options.lines):]
for evt in evtdata_list:
if options.timeframe:
pass
print('{0}: {1}'.format(node, format_event(evt)))
if 'timestamp' in evt and evt['timestamp'] is not None:
display = dt.strptime(evt['timestamp'], '%Y-%m-%dT%H:%M:%S')
if display > timeframe:
print('{0}: {1}'.format(node, format_event(evt)))
else:
print('{0}: {1}'.format(node, format_event(evt)))