Devices, including gateways and sub-devices, can report logs to the cloud. Query on-premises device logs on the Simple Log Service page in the IoT Platform console to troubleshoot issues.
Prerequisites
- The device is developed by using the Android SDK or C SDK and configured to report logs. For more information, see Report device logs.
- If the device has a log reporting switch implemented using an SDK, navigate to . Find the device and click View. On the Device Details page, turn on the Report On-premises Device Logs switch. This step is not required if the device does not have a log reporting switch.
Query on-premises device logs
- Log on to the IoT Platform console.
On the Overview page, find the instance that you want to manage and click the instance ID or instance name.
- In the navigation pane on the left, click .
- Select a product and click the On-premises Device Logs tab.
- Enter search criteria and click the search icon.
The following table describes the available search criteria.
Search criterion Description DeviceName Enter a device name to search for logs related to the device. TraceId Enter a trace ID to search for logs across linked modules. Module name keyword Enter a module name to search for logs that the module generated. Content keyword Enter a keyword from the log content. Supported keywords include request parameters of API requests, error reasons, message ID (MessageID), client ID (clientId), and operation (Operation). Time range Select a time range for when the logs were reported.
Log fields
Each log entry contains the following fields.
| Parameter | Description |
| Reporting time | The time when the device reported the log. |
| Collection time | The time when the device collected the log. |
| TraceId | The trace ID, which you can use to search for logs across linked modules. |
| DeviceName | The device name. |
| Log level | By default, logs of all levels are displayed. You can filter logs by level. The log levels are listed in descending order of severity, except for OTHER:
|
| Module name | The name of the module that generated the log.
|
| Content | The detailed log content. |
Device log analysis
Each log entry includes a result status code specified by the Code parameter. You can analyze logs based on this status code.
The error code can be one generated by the device-side SDK (Android SDK error codes and C SDK error codes) or a custom status code.