Example: Log operations using REST APIs

A GET request to /rest/v1/logs URI returns all entries from all the logs on the switch, including logs from internal processes.

The information returned by this request was not optimized for human readability. If you want to examine the log entries, Hewlett Packard Enterprise recommends that you use the Web UI. The Web UI also provides a method to export log entries.

In the following example, the MESSAGE_ID parameter filters the output to include event log messages only:

  • MESSAGE_ID 50c0fa81c2a545ec982a54293f1b1945 identifies event log messages from the active management module.

  • MESSAGE_ID 73d7a43eaf714f97bbdf2b251b21cade identifies event log messages from the standby management module. Not all switches have a standby management module.

Example method and URI:

GET "https://192.0.2.5/rest/v1/logs?
limit=1000&
priority=4&
since=24%20hour%20ago&
MESSAGE_ID=50c0fa81c2a545ec982a54293f1b1945,73d7a43eaf714f97bbdf2b251b21cade"