-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get log entries with pagination #243
Conversation
This vendor is not following the Redfish specification: "Entries": {
"$ref": "http://redfish.dmtf.org/schemas/v1/LogEntryCollection.json#/definitions/LogEntryCollection",
"description": "The link to the log entry collection.",
"longDescription": "This property shall contain a link to a resource collection of type LogEntryCollection.",
"readonly": true
}, An issue should be opened with that vendor asking that they fix their implementation to follow the spec. |
And the "Members": {
"autoExpand": true,
"description": "The members of this collection.",
"items": {
"$ref": "http://redfish.dmtf.org/schemas/v1/LogEntry.json#/definitions/LogEntry"
},
"longDescription": "This property shall contain an array of links to the members of this collection.",
"readonly": true,
"type": "array"
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks close, and good overall. A few small things, and we need to make sure it is following the actual spec and not one vendors flawed implementation.
Thanks for working on this!
redfish/logentrycollection.go
Outdated
// MembersNextLink is the link used for pagination | ||
MembersNextLink string `json:"[email protected]"` | ||
// rawData holds the original serialized JSON so we can compare updates. | ||
rawData []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawData
would not be needed here. That's only necessary when a structure has updatable fields where an Update()
call is required.
redfish/logentrycollection.go
Outdated
} | ||
|
||
// UnmarshalJSON unmarshals a LogEntry object from the raw JSON. | ||
func (logEntryCollection *LogEntryCollection) UnmarshalJSON(b []byte) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since rawData
isn't needed to be captured, this custom marshalling can be removed completely.
Thanks for your comments!! As for this Please let me check this issue because I took the example directly from the dmtf website here: |
I've added filtering as an option and vendor agnostic collection retrieval using links to follow the spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xflipped!
* fix: get log entries * fix: remove rawData * feat: add filtering * fix: collect entities
so it still need to query each log entry as a link ? i have tested some manufacturer device, and /redfish/v1/Managers/{ManagerId}/LogServices/{LogServiceId}/Entries api can got all enties completely |
there's no need to query each log entry as a link, a collection will be retrieved correctly taking into account pagination |
sorry, i still don't quite understand, and which function can i use to get the latest 10 log entries,at least i should know how many logs it has ? |
I've faced with the following situation when retrieving logs from LogService:
Link to entries:
Actual entry collection object:
As you can see, this is the case when the original link leads only to the first N (here: N=50) entries. So I would like to propose changes that allow all entries to be retrieved.
I've also noticed that even though the log entry collection has a json field "Members" that normally contains links, here it contains a list of log entries directly:
Normally:
Logs:
So I think there is no need to query each log entry as a link. These changes can also be seen in my PR