diff --git a/confluent_client/bin/nodeeventlog b/confluent_client/bin/nodeeventlog index 1587b6bd..6d35ed57 100755 --- a/confluent_client/bin/nodeeventlog +++ b/confluent_client/bin/nodeeventlog @@ -201,10 +201,20 @@ elif wantsources is not None: for node in nodes: found = set(x.lower() for x in sources_seen.get(node, ())) missing = wantsources - found - if missing and found: + if not missing: + continue + if found: sys.stderr.write('{0}: no such log source: {1}, this node has {2}\n' .format(node, ','.join(sorted(missing)), ','.join(sorted(sources_seen[node])))) + else: + # A log that holds no entries names no source, so an empty answer + # here is as often a quiet platform as a wrong name. Either way + # saying nothing would look like the log simply had nothing in it. + sys.stderr.write( + '{0}: no entries from any log source, so nothing could match ' + '{1}\n'.format(node, ','.join(sorted(missing)))) + exitcode |= 1 if options.lines and not listmode: for node in nodes: diff --git a/confluent_client/doc/man/nodeeventlog.ronn b/confluent_client/doc/man/nodeeventlog.ronn index a4d357cb..abce6d84 100644 --- a/confluent_client/doc/man/nodeeventlog.ronn +++ b/confluent_client/doc/man/nodeeventlog.ronn @@ -15,6 +15,11 @@ noisier than others. Reading gathers every log the platform describes as an event log, wherever it keeps them, and `-s` narrows the output to the ones asked for. `-s list` names the logs a node offers rather than showing entries. +A source is named by the entries that come from it, so a log that holds no +entries is not among them, and a node whose logs are all empty names none. An +ipmi managed node keeps its events in the one log the spec gives it, which is +reported as `SEL`. + Clearing is deliberately narrower than reading: it only touches the logs the platform's own manager publishes, so a log that only a read reaches is never destroyed by one. A selection cannot be cleared, so `-s` and `clear` are @@ -39,6 +44,8 @@ refused together. only show entries from the named logs, comma delimited and matched without regard to case. `-s list` names the logs the node offers instead of showing entries. A platform that named a log "list" would be shadowed by that. + Asking for a log the node named nothing from is reported on stderr and + exits non-zero, rather than looking like an empty log. * `-h`, `--help`: Show help message and exit diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 2e832978..859eda28 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -933,6 +933,10 @@ class IpmiHandler: await self.output.put(msg.EventCollection(eventout, name=self.node)) def pyghmi_event_to_confluent(self, event): + # An ipmi platform keeps its events in one place and the spec has a + # name for it, so say so rather than leaving the source blank and + # having a caller asking for a named log get nothing back + event.setdefault('log_id', 'SEL') event['severity'] = _str_health(event.get('severity', 'unknown')) if 'event_data' in event: event['event'] = '{0} - {1}'.format(