|
|
|
@ -269,6 +269,8 @@ class RedfishUtils(object):
|
|
|
|
|
def get_logs(self):
|
|
|
|
|
log_svcs_uri_list = []
|
|
|
|
|
list_of_logs = []
|
|
|
|
|
properties = ['Severity', 'Created', 'EntryType', 'OemRecordFormat',
|
|
|
|
|
'Message', 'MessageId', 'MessageArgs']
|
|
|
|
|
|
|
|
|
|
# Find LogService
|
|
|
|
|
response = self.get_request(self.root_uri + self.manager_uri)
|
|
|
|
@ -284,12 +286,13 @@ class RedfishUtils(object):
|
|
|
|
|
if response['ret'] is False:
|
|
|
|
|
return response
|
|
|
|
|
data = response['data']
|
|
|
|
|
for log_svcs_entry in data[u'Members']:
|
|
|
|
|
for log_svcs_entry in data.get('Members', []):
|
|
|
|
|
response = self.get_request(self.root_uri + log_svcs_entry[u'@odata.id'])
|
|
|
|
|
if response['ret'] is False:
|
|
|
|
|
return response
|
|
|
|
|
_data = response['data']
|
|
|
|
|
log_svcs_uri_list.append(_data['Entries'][u'@odata.id'])
|
|
|
|
|
if 'Entries' in _data:
|
|
|
|
|
log_svcs_uri_list.append(_data['Entries'][u'@odata.id'])
|
|
|
|
|
|
|
|
|
|
# For each entry in LogServices, get log name and all log entries
|
|
|
|
|
for log_svcs_uri in log_svcs_uri_list:
|
|
|
|
@ -299,15 +302,16 @@ class RedfishUtils(object):
|
|
|
|
|
if response['ret'] is False:
|
|
|
|
|
return response
|
|
|
|
|
data = response['data']
|
|
|
|
|
logs['Description'] = data['Description']
|
|
|
|
|
logs['Description'] = data.get('Description',
|
|
|
|
|
'Collection of log entries')
|
|
|
|
|
# Get all log entries for each type of log found
|
|
|
|
|
for logEntry in data[u'Members']:
|
|
|
|
|
# I only extract some fields - Are these entry names standard?
|
|
|
|
|
list_of_log_entries.append(dict(
|
|
|
|
|
Name=logEntry[u'Name'],
|
|
|
|
|
Created=logEntry[u'Created'],
|
|
|
|
|
Message=logEntry[u'Message'],
|
|
|
|
|
Severity=logEntry[u'Severity']))
|
|
|
|
|
for logEntry in data.get('Members', []):
|
|
|
|
|
entry = {}
|
|
|
|
|
for prop in properties:
|
|
|
|
|
if prop in logEntry:
|
|
|
|
|
entry[prop] = logEntry.get(prop)
|
|
|
|
|
if entry:
|
|
|
|
|
list_of_log_entries.append(entry)
|
|
|
|
|
log_name = log_svcs_uri.split('/')[-1]
|
|
|
|
|
logs[log_name] = list_of_log_entries
|
|
|
|
|
list_of_logs.append(logs)
|
|
|
|
|