The device log feature of IoT Platform allows you to retain logs of the last seven days by default. This feature also allows you to export IoT Platform operational logs to the Logstores of Log Service for persistent storage. After you enable the log dump feature, you can search and analyze logs in the IoT Platform console. This feature provides multiple functions, such as log reports, dashboard subscription, and alerts.
Prerequisites
Log Service is activated. For more information, see Activate Log Service.
Enable the log dump feature
You must enable the log dump feature for products in sequence.
Use the log search and analysis feature
- Search and analyze logs: On the Raw Logs tab, you can use SQL statements to search logs of a specified period of time. Then, you can create statistical charts based on analytical results. For more information about the SQL syntax, see Search syntax and Analysis syntax. For more information about statistical charts, see Analytical charts.
- Quick analysis: After you search logs on the Raw Logs tab, you can view the distribution of a field in a specified period of time based on the search results. For more information, see Quick analysis.
- View reports: On the Log Report tab, you can view log reports in a specified period of time. Log reports reflect
the statuses and exceptions of devices. The following table describes the reports.
Report Description Number of Times Device Online & Offline The line chart shows the number of times that devices connect to IoT Platform, and number of times that devices disconnect from IoT Platform in a specified period of time. Device Uplink & Downlink Messages The line chart shows the number of upstream messages and number of downstream messages in a specified period of time. Top 20 Devices by Uplink&Downlink Message The list shows the top 20 devices that report or receive the most upstream or downstream messages, and the number of messages of each device. Error Distribution for TSL Validation The pie chart shows the distribution of data parsing errors in a specified period of time. You can search logs by error code and view the details of data parsing errors in logs. This allows you to improve a data parsing script in an efficient manner.
Top 10 Devices by Data Parsing Script Error The list shows the top 10 devices on which the most data parsing errors occur, and the number of errors that occur on each device. You can search logs by device name and view the details of data parsing errors in logs. This allows you to improve a data parsing script in an efficient manner.
Error Distribution for TSL Validation The pie chart shows the distribution of Thing Specification Language (TSL) validation errors in a specified period of time. You can search logs by error code, view the details of TSL validation errors in logs, and troubleshoot issues.
Top 10 Devices by TSL Validation Error The list shows the top 10 devices on which the most TSL validation errors occur, and the number of errors that occur on each device in a specified period of time. You can search logs by device name, view the details of TSL validation errors in logs, and troubleshoot issues.
Server-side Subscription Messages Forwarded The line chart shows the total number of messages that are forwarded by an Advanced Message Queuing Protocol (AMQP) or Message Service (MNS) server-side subscription in a specified period of time. Last 20 Device Anomaly Messages The pie chart shows the last 20 device anomaly messages. You can search logs by device name and error code, view the details of device anomaly messages in logs, and troubleshoot issues.
Cloud Service Messages Forwarded The line chart shows the total number of messages that are forward by the data forwarding feature in a specified period of time. Last 20 Data Forwarding Errors The line chart shows the last 20 data forwarding errors of the rules engine in a specified period of time. You can search logs by device name and error code, view the details of data forwarding errors for the rules engine in logs, and troubleshoot issues.
Error Distribution for Cloud API Calls The pie chart shows the distribution of API invocation errors in a specified period of time. You can search logs by API operation name and troubleshoot issues by using log details and error codes.
Note:
- Reports show data of the last one hour (time frame). The time interval for line charts is one minute.
- To set a time range, you can select the required value from the Time drop-down list
in the upper-right corner of the Log Dump tab or choose
>Select Time Range in the upper-right corner of a report card.
- To set a time interval for a line chart, you must write an SQL statement on the Raw Logs tab. For more information about the SQL syntax, see Date and time functions.
For example, you can use the
bizCode:device | SELECT date_format(date_trunc('hour',__time__), '%m-%d %H:%i') AS Time, count(1) AS count , operation GROUP BY Time, operation ORDER BY Time limit 1440
query statement to set the time interval to one hour.
- Subscribe to a dashboard: IoT Platform converts dashboards into images on a regular basis and sends these images to the required customers by using emails or DingTalk chatbots. For more information about how to subscribe to a dashboard, see Subscribe to a dashboard.
- Set alerts: If one of the alert conditions is met, IoT Platform sends alerts by using multiple notification methods. These methods include the text message, phone call, email, and DingTalk chatbot. For more information about how to set alerts, see Create an alert rule.
Disable the log dump feature
You can disable the log dump feature for a product at any time. This allows you to save storage space. Procedure: