From af025f7304424e5b1074ae6c1179b50cf821379c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 25 Jul 2019 13:09:52 -0400 Subject: [PATCH] Present log name when provided in nodeeventlog Some managers combine logs, allow disambiguation through including in output. --- confluent_client/bin/nodeeventlog | 6 ++++-- confluent_server/confluent/messages.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/nodeeventlog b/confluent_client/bin/nodeeventlog index 03f870c5..291f6ac4 100755 --- a/confluent_client/bin/nodeeventlog +++ b/confluent_client/bin/nodeeventlog @@ -1,7 +1,7 @@ #!/usr/bin/python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright 2015-2017 Lenovo +# Copyright 2015-2019 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,6 +65,8 @@ def format_event(evt): display = dt.strptime(evt['timestamp'], '%Y-%m-%dT%H:%M:%S') retparts.append(display.strftime('%m/%d/%Y %H:%M:%S')) dscparts = [] + if evt.get('log_id', None): + retparts.append(evt['log_id'] + ':') if 'component_type' in evt and evt['component_type'] is not None: dscparts.append(evt['component_type']) if 'component' in evt and evt['component'] is not None: @@ -102,4 +104,4 @@ for rsp in func('/noderange/{0}/events/hardware/log'.format(noderange)): if 'events' in thisdata: evtdata = thisdata['events'] for evt in evtdata: - print '{0}: {1}'.format(node, format_event(evt)) + print('{0}: {1}'.format(node, format_event(evt))) diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index fa0bee06..36213d28 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 IBM Corporation -# Copyright 2015-2017 Lenovo +# Copyright 2015-2019 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1249,6 +1249,7 @@ class EventCollection(ConfluentMessage): 'timestamp': event.get('timestamp', None), 'message': event.get('message', None), 'record_id': event.get('record_id', None), + 'log_id': event.get('log_id', None), } if event['severity'] not in valid_health_values: raise exc.NotImplementedException(