This topic describes how to enable the log dump feature in the IoT Platform console to dump operational logs to Simple Log Service.
Prerequisites
Simple Log Service is activated.
A product is created, and a device is connected. For more information, see Create a product.
Enable the IoT Platform log dump feature
If you want to store logs from more than one product for an extended period, you must enable the log dump feature for each product.
- 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 left-side navigation pane, choose .
- Select a product and click the IoT Platform Log Dump tab.
- Click Enable.
- Follow the on-screen instructions to enable the IoT Platform log dump feature. Note If Log Service is not activated, you can click Enable to go to the Log Service activation page.
- In the dialog box that appears, click Create next to the Role and Log Storage Location sections. Note If Created is displayed next to the Role and Log Storage Location sections, skip this step.
- Click OK.
After you enable the IoT Platform log dump feature for the product, IoT Platform automatically creates a log storage location and a service-linked role that is used to export logs.- Service-linked role: You can use this role to obtain permissions to export logs. For more information, see AliyunServiceRoleForIoTLogExport service linked role.
- Log storage location:
- Project:
iot-log-${uid}-${regionId}. Replace the${uid}variable with your Alibaba Cloud account ID and the${regionId}variable with the ID of the region where IoT Platform resides. - Logstore: iot-logs.
All your products connected to IoT Platform share the log storage location. You can identify the logs of a product based on the ProductKey. For more information, see IoT Platform logs.
- Project:
- In the dialog box that appears, click Create next to the Role and Log Storage Location sections.
- Specify the retention period of logs. Logs exported from IoT Platform are deleted when their retention period ends. You can set the retention period to 1 to 3,000 days. The default log retention period is 7 days. You can also turn on the Permanent Storage switch to retain logs permanently.
On the IoT Platform Log Dump tab, click Set log save time. In the message that appears, click OK. On the Logstore Attributes page, click Modify, set the Data Retention Period parameter, and then click Save.
What to do next
After you dump logs from IoT Platform to Simple Log Service, you can query, analyze, download, ship, and transform the logs. You can also configure alerts for the logs. For more information, see Common operations on logs of Alibaba Cloud services.
If you no longer need to dump logs to Simple Log Service, you can click Stop Dump on the IoT Platform Log Dump tab.
After you disable the log dump feature, newly generated logs are no longer exported to Simple Log Service. Exported logs are automatically deleted when the specified data retention period ends.