Operational logs

Updated at:
Copy as MD

After the sample code for the secure tunnel feature runs, you can view the related logs on the device.

Prerequisites

The sample code for the secure tunnel feature of the C Link SDK has been configured. For more information, see Use the sample code.

Device logs

  • Device connection logs

    [1611660469.476][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    [1611660469.476][LK-0317] LightSwitch&a18wP******
    [1611660469.476][LK-0318] 58FBF5F24B21A68EF398A22AE05C5E80AD6338AA9A338EA96857C99367******
    establish tcp connection with server(host='iot-***-******.iot-as-mqtt.unify.aliyuncs.com', port=[8883])
    success to establish tcp, fd=6
    [1611660470.046][LK-0313] MQTT connect success in 570 ms
    AIOT_MQTTEVT_CONNECT
  • Logs for enabling the secure tunnel:

    The following logs indicate that the device notified IoT Platform that the secure tunnel feature is ready.
    [1611660470.047][LK-0309] sub: /sys/a18wP******/LightSwitch/edge/debug/switch
    [1611660470.047][LK-1C00] remote proxy thread start!
     heartbeat response
    suback, res: -0x0000, packet id: 1, max qos: 1
  • Logs for creating a secure tunnel:

    After IoT Platform creates a secure tunnel, the device accepts a connection request, which generates the following message logs.

    [1632377338.388][LK-0309] pub: /sys/a18wP******/LightSwitch/secure_tunnel/notify
    
    [LK-030A] < 7B 22 73 63 68 65 6D 61  22 3A 22 77 73 73 22 2C | {"schema":"wss",
    [LK-030A] < 22 70 61 74 68 22 3A 22  2F 74 75 6E 6E 65 6C 2F | "path":"/tunnel/
    [LK-030A] < 34 39 63 36 65 62 63 64  2D 63 30 31 37 2D 34 33 | 49c6ebcd-c017-43
    [LK-030A] < 62 30 2D 38 31 35 34 2D  37 37 38 35 39 62 30 34 | b0-8154-77859b**
    [LK-030A] < 66 32 30 36 2F 64 65 73  74 22 2C 22 74 75 6E 6E | ****/dest","tunn
    [LK-030A] < 65 6C 5F 69 64 22 3A 22  34 39 63 36 65 62 63 64 | el_id":"49c6ebcd
    [LK-030A] < 2D 63 30 31 37 2D 34 33  62 30 2D 38 31 35 34 2D | -c017-43b0-8154-
    [LK-030A] < 37 37 38 35 39 62 30 34  66 32 30 36 22 2C 22 70 | 7785******","p
    [LK-030A] < 61 79 6C 6F 61 64 5F 6D  6F 64 65 22 3A 22 72 65 | ayload_mode":"re
    [LK-030A] < 6C 61 79 22 2C 22 70 6F  72 74 22 3A 34 34 33 2C | lay","port":443,
    [LK-030A] < 22 68 6F 73 74 22 3A 22  69 6F 74 2D 73 65 63 75 | "host":"iot-secu
    [LK-030A] < 72 65 2D 74 75 6E 6E 65  6C 2D 68 7A 2D 70 72 65 | re-tunnel-**-***
    [LK-030A] < 2E 61 6C 69 79 75 6E 63  73 2E 63 6F 6D 22 2C 22 | .aliyuncs.com","
    [LK-030A] < 6F 70 65 72 61 74 69 6F  6E 22 3A 22 63 6F 6E 6E | operation":"conn
    [LK-030A] < 65 63 74 22 2C 22 75 72  69 22 3A 22 77 73 73 3A | ect","uri":"wss:
    [LK-030A] < 2F 2F 69 6F 74 2D 73 65  63 75 72 65 2D 74 75 6E | //iot-secure-tun
    [LK-030A] < 6E 65 6C 2D 68 7A 2D 70  72 65 2E 61 6C 69 79 75 | nel-******.aliyu
    [LK-030A] < 6E 63 73 2E 63 6F 6D 2F  74 75 6E 6E 65 6C 2F 34 | ncs.com/tunnel/4
    [LK-030A] < 39 63 36 65 62 63 64 2D  63 30 31 37 2D 34 33 62 | 9c6ebcd-c017-43b
    [LK-030A] < 30 2D 38 31 35 34 2D 37  37 38 35 39 62 30 34 66 | 0-8154-77859b***
    [LK-030A] < 32 30 36 2F 64 65 73 74  22 2C 22 74 6F 6B 65 6E | ***/dest","token
    [LK-030A] < 22 3A 22 37 37 65 32 38  33 38 66 2D 31 33 30 38 | ":"77e2838f-1308
    [LK-030A] < 2D 34 30 32 64 2D 39 34  39 35 2D 38 34 39 63 38 | -402d-9495-849c8
    [LK-030A] < 63 32 35 63 36 36 36 22  7D                      | c******"}
    
    [1632377338.388][LK-1C00] _switch_topic_handler payload:{"schema":"wss","path":"/tunnel/49c6ebcd-c017-43b0-8154-7785******/dest","tunnel_id":"49c6ebcd-c017-43b0-8154-7785******","payload_mode":"relay","port":443,"host":"iot-secure-tunnera_event_cb AIOT_RA_EVT_OPEN_WEBSOCKET 49c6ebcd-c017-43b0-8154-7785******
    [1632377338.511][LK-1C00] start to create cloud channel
    [1632377338.511][LK-1C00] connect remote service host iot-secure-tunnel-******.aliyuncs.com, port 443establish tcp connection with server(host='iot-secure-tunnel-******.aliyuncs.com', port=[443])
    success to establish tcp, fd=4
    local port: 47000
    [1632377338.588][LK-1000] establish mbedtls connection with server(host='iot-secure-tunnel-******.aliyuncs.com', port=[443])
    [1632377338.644][LK-1000] success to establish mbedtls connection, (cost 55299 bytes in total, max used 57987 bytes)
    [1632377338.700][LK-0F10] open_cloud_proxy_channel success
    [1632377338.700][LK-1C00] websocket 49c6ebcd-c017-43b0-8154-7785****** opened
    ra_event_cb AIOT_RA_EVT_CONNECT 49c6ebcd-c017-43b0-8154-7785******
    heartbeat response

What to do next

For any error messages in the operational logs, see the status code descriptions in aiot_ra_api.h to resolve the issues.