All Products
Search
Document Center

IoT Platform:View logs

Last Updated:Jul 07, 2023

After you use the sample code to connect a device to IoT Platform over Message Queuing Telemetry Transport (MQTT), you can view logs on the device.

Prerequisites

For more information, see Example.

Device logs

You can view the running result on the device.

  • Device connection logs

    The following log data indicates that the device is connected to IoT Platform.

    [1578054042.600][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    [1578054042.600][LK-0317] LightSwitch&a18wP******
    [1578054042.600][LK-0318] 24FEB95E42CADB18D0E093F412E6AC27705AA8DF6DB3B649566728E685******
    [1578054042.600][LK-0319] a18wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.0.0,securemode=2,signmethod=hmacsha256,ext=1,|
    establish mbedtls connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[1883])
    success to establish mbedtls connection, fd = 3
    [1578054042.711][LK-0313] MQTT connect success
    AIOT_MQTTEVT_CONNECT
  • Logs about message receiving

    After you call the RRpc operation of IoT Platform to send the ping command to a custom topic, such as /a18wP******/LightSwitch/user/get, the following log data is generated on the device.

    • Log data:

      [1578054379.700][LK-0309] pub: /ext/rrpc/1213074107617******/a18wP******/LightSwitch/user/get
      
      [LK-030A] < 70 69 6E 67                                      | ping
      
      pub, qos: 0, topic: 1213074107617******/a18wP******/LightSwitch/user/get
      pub, payload: ping
    • Log description:

      /ext/rrpc/1213074107617******/a18wP******/LightSwitch/user/get indicates the topic to which the RRPC message is sent. 1213074107617****** indicates the message ID. ping indicates the message payload. For more information, see Use custom topics (recommended).

  • Logs about device response

    After the device receives the RRPC message, the device sends a response. The following log data is printed:

    [1578054379.700][LK-0309] pub: /ext/rrpc/1213074107617******/a18wP******/LightSwitch/user/get
    
    [LK-030A] > 70 6F 6E 67                                      | pong

IoT Platform logs

You can log on to the IoT Platform console . In the left-side navigation pane, choose Maintenance > Device Log. Select a product to view the communication logs of the device.

What to do next

For more information about error messages in logs, see Common error codes