All Products
Search
Document Center

IoT Platform:View logs

Last Updated:Jul 07, 2023

After you run the sample code to implement an MQTT-based dynamic registration, you can view logs on the device.

Prerequisites

The sample code in Link SDK for C is configured. For more information, see Example on how to dynamically register a device over MQTT.

Device logs

You can view the running result on the device.When you perform a dynamic registration, logs are not generated on the Log Service page of the IoT Platform console.

  • Logs about dynamic registration

    The following log data indicates that the device send a dynamic registration request to IoT Platform.

    [1622428788.933][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    core_sysdep_network_establish host a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com 443, type 0
    establish tcp connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443])
    success to establish tcp, fd=3
    local port: 53828
    [1622428788.933][LK-1000] establish mbedtls connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443])
    [1622428788.999][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes)
    [1622428789.166][LK-0313] MQTT connect success in 231 ms
  • Logs about downstream response

    • The following log data indicates that IoT Platform sends a response to the device when you use pre-registration unique-certification-per-product authentication.

      [LK-030A] < 7B 22 64 65 76 69 63 65  53 65 63 72 65 74 22 3A | {"deviceSecret":
      [LK-030A] < 22 30 66 34 38 31 32 31  65 38 63 62 35 35 63 36 | "0f48121e8cb55c6
      [LK-030A] < 35 65 66 62 61 37 65 30  33 66 37 39 38 37 62 65 | 5efba7e03f******
      [LK-030A] < 65 22 2C 22 70 72 6F 64  75 63 74 4B 65 79 22 3A | *","productKey":
      [LK-030A] < 22 67 37 68 30 66 6A 79  33 52 31 4F 22 2C 22 64 | "a18wP******","d
      [LK-030A] < 65 76 69 63 65 4E 61 6D  65 22 3A 22 4C 69 67 68 | eviceName":"Ligh
      [LK-030A] < 74 53 77 69 74 63 68 50  72 65 41 75 74 68 22 7D | tSwitch"}
      
      device secret: 0f48121e8cb55c65efba7e03f7******
      [1622429683.799][LK-1000] adapter_network_deinit
    • The following log data indicates that IoT Platform sends a response to the device when you use preregistration-free unique-certification-per-product authentication.

      [LK-030A] < 7B 22 63 6C 69 65 6E 74  49 64 22 3A 22 34 66 34 | {"clientId":"4f4
      [LK-030A] < 61 71 59 78 44 43 4C 6B  6F 41 50 32 46 4B 4C 70 | aqYxDCLkoAP2FKLp
      [LK-030A] < 79 30 30 30 31 30 30 22  2C 22 70 72 6F 64 75 63 | y******","produc
      [LK-030A] < 74 4B 65 79 22 3A 22 67  37 68 30 66 6A 79 33 52 | tKey":"a18wP****
      [LK-030A] < 31 4F 22 2C 22 64 65 76  69 63 65 4E 61 6D 65 22 | **","deviceName"
      [LK-030A] < 3A 22 4C 69 67 68 74 53  77 69 74 63 68 22 2C 22 | :"LightSwitch","
      [LK-030A] < 64 65 76 69 63 65 54 6F  6B 65 6E 22 3A 22 5E 31 | deviceToken":"^1
      [LK-030A] < 5E 31 36 32 32 34 32 38  37 38 39 31 35 35 5E 32 | ^1622428789155^2
      [LK-030A] < 63 33 66 34 38 33 35 63  30 34 36 39 32 65 22 7D | c3f4835c******"}
      
      clientid: 4f4aqYxDCLkoAP2FKLpy******|authType=connwl,securemode=-2,_ss=1,ext=3,_v=sdk-c-4.1.0|
      username: LightSwitch&a18wP******
      password: ^1^1622428789155^2c3f4835c******
      [1622428789.166][LK-1000] adapter_network_deinit

What's next

For more information about error messages in logs, see aiot_dynregmq_api.h. You can troubleshoot errors based on the instructions.