cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1666
Views
0
Helpful
1
Replies

How to get all SEL log via restful api(redfish)

HI all,

According to the example of official website

 curl -GET https://10.10.10.10/redfish/v1/Managers/CIMC/LogServices
/SEL/Entries\?\$skip=2\&\$top=2 -u admin:admin123 --insecure

The upper example code can get top two and skipping two records of sel log.

 

curl -GET https://10.10.10.10/redfish/v1/Chassis/1/LogServices/SEL/Erestfurestful api redfish SELl api redfish SELntries/ -k -u admin:Admin123

The example code can get the top 50 records of sel log by default.

 

My question is:  how to get all sel log with one http "get" request?

I don't want to get the total record number of sel log, then get sel log record by record. I just want to get all sel log with one or few http request (As I know, the upper limit of record fetching in one return is 500)

 

I also find two questions

1. In address "redfish/v1/Chassis/1/LogServices/SEL/Entries/" , I can't find total number of record of sel log and left number of record of sel log

2. In address "redfish/v1/Chassis/1/LogServices/SEL/Entries/" , I can't find the url link to next 50 record of sel log.

3. Does Cisco support parameter "expand"?  Refer to the DMTF specification.

 

$skipInteger indicating the number of Members in the Resource Collection to skip before retrieving the first resource.http://resourcecollection?$skip=5
$topInteger indicating the number of Members to include in the response. The minimum value for this parameter is 1. The default behavior is to return all Members.http://resourcecollection?$top=30
$expandInclude data from links in the resource inline within the current payload, depending on the value of the expand.http://resourcecollection?$expand=.($levels=1)
$selectInclude a subset of the properties of a resource based on the expression specified in the query parameters for this option.http://resourcecollection?$select=SystemType,Status
$filterInclude a subset of the members of a collection based on the expression specified in the query parameters for this option.http://resourcecollection?$filter=SystemType eq 'Physical'
1 Reply 1

Sandeep Kumar
Cisco Employee
Cisco Employee

Hi Kd, 

 

You can use below script to get the SEL logs using Redfish API:

https://github.com/sandkum5/cimc-get-sel-logs

 

To get the log count, you would need to send a request to redfish/v1/Chassis/1/LogServices/SEL/Entries/?$top=1 

Function get_sel_log_count has the logic to get the count. 

 

To get sel logs in pages, you would need to use skip and count. 

E.g. Below link will get sel log entries from 201 to 400. 

redfish/v1/Chassis/1/LogServices/SEL/Entries/?$skip=200&$top=200


Please let me know if you still have any questions.

 

Regards,
Sandeep