From 3433635e9b1b5ba8ae94da94623048da0819bd7b Mon Sep 17 00:00:00 2001 From: Tinashe Date: Thu, 26 Jan 2023 10:16:33 -0500 Subject: [PATCH] nodeeventlog: timeframe option --- confluent_client/bin/nodeeventlog | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodeeventlog b/confluent_client/bin/nodeeventlog index 0a0686f6..680ea400 100755 --- a/confluent_client/bin/nodeeventlog +++ b/confluent_client/bin/nodeeventlog @@ -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)))