All Products
Search
Document Center

IoT Platform:View logs

Last Updated:Jul 07, 2023

After a sample data compression program is executed on a device, you can view logs on the device and in the IoT Platform console.

Prerequisites

A sample data compression program that is written by using Link SDK for C is configured. For more information, see Example.

Device logs

You can view the execution result on the device.

  • Connection logs.

    If the following logs are generated, a connection between the device and IoT Platform is established:

    [1673252439.000][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    [1673252439.000][LK-032A] mqtt host: xxxxxx.xxxxx.xxxxxx.xxxxxxx.com
    [1673252439.000][LK-0317] user name: compress_xxxxxxx
    [1673252439.000][LK-0318] password: 570D5xxxxxxxxx
    success to establish tcp, fd=3
    local port: 47622
    [1673252439.100][LK-1000] establish mbedtls connection with server(host='xxxxx.xxxxxx.unify.aliyuncs.com', port=[443])
    [1673252439.288][LK-1000] success to establish mbedtls connection, (cost 45326 bytes in total, max used 48294 bytes)
    [1673252440.111][LK-0313] MQTT connect success in 1109 ms
    AIOT_MQTTEVT_CONNECT
  • The following topic contains responses to messages that are submitted by the device.

    [1673252440.111][LK-0309] sub: /sys/a1xxxxxx/compress_test_001/codec/topic/update_reply
    suback, res: -0x0000, packet id: 1, max qos: 1
  • The following topics are used by the device to submit messages.

    [1673252440.611][LK-0309] pub: /sys/a1xxxxxxx/compress_test_001/codec/topic/update
    
    [LK-030A] > 7B 22 70 61 72 61 6D 73  22 3A 5B 7B 22 74 6F 70 | {"params":[{"top
    [LK-030A] > 69 63 22 3A 20 22 2F 61  31 68 45 39 36 7A 66 38 | ic": "/a1xxxxxx
    [LK-030A] > 73 34 2F 63 6F 6D 70 72  65 73 73 5F 74 65 73 74 | /compress_test
    [LK-030A] > 5F 30 30 31 2F 75 73 65  72 2F 75 70 64 61 74 65 | _001/user/update
    [LK-030A] > 22 2C 22 6F 70 65 72 61  74 69 6F 6E 22 3A 20 22 | ","operation": "
    [LK-030A] > 64 65 63 6F 6D 70 72 65  73 73 22 2C 22 66 6F 72 | decompress","for
    [LK-030A] > 6D 61 74 22 3A 20 22 67  7A 69 70 22 7D 2C 7B 22 | mat": "gzip"},{"
    [LK-030A] > 74 6F 70 69 63 22 3A 20  22 2F 73 79 73 2F 61 31 | topic": "/sys/a1
    [LK-030A] > 68 45 39 36 7A 66 38 73  34 2F 63 6F 6D 70 72 65 | xxxxxx/compre
    [LK-030A] > 73 73 5F 74 65 73 74 5F  30 30 31 2F 74 68 69 6E | ss_test_001/thin
    [LK-030A] > 67 2F 65 76 65 6E 74 2F  70 72 6F 70 65 72 74 79 | g/event/property
    [LK-030A] > 2F 70 6F 73 74 22 2C 22  6F 70 65 72 61 74 69 6F | /post","operatio
    [LK-030A] > 6E 22 3A 20 22 64 65 63  6F 6D 70 72 65 73 73 22 | n": "decompress"
    [LK-030A] > 2C 22 66 6F 72 6D 61 74  22 3A 20 22 67 7A 69 70 | ,"format": "gzip
    [LK-030A] > 22 7D 2C 7B 22 74 6F 70  69 63 22 3A 20 22 2F 61 | "},{"topic": "/a
    [LK-030A] > 31 68 45 39 36 7A 66 38  73 34 2F 63 6F 6D 70 72 | 1xxxxxxx/compr
    [LK-030A] > 65 73 73 5F 74 65 73 74  5F 30 30 31 2F 75 73 65 | ess_test_001/use
    [LK-030A] > 72 2F 75 70 64 61 74 65  5F 72 65 70 6C 79 22 2C | r/update_reply",
    [LK-030A] > 22 6F 70 65 72 61 74 69  6F 6E 22 3A 20 22 63 6F | "operation": "co
    [LK-030A] > 6D 70 72 65 73 73 22 2C  22 66 6F 72 6D 61 74 22 | mpress","format"
    [LK-030A] > 3A 20 22 67 7A 69 70 22  7D 2C 7B 22 74 6F 70 69 | : "gzip"},{"topi
    [LK-030A] > 63 22 3A 20 22 2F 73 79  73 2F 61 31 68 45 39 36 | c": "/sys/a1xxxxx
    [LK-030A] > 7A 66 38 73 34 2F 63 6F  6D 70 72 65 73 73 5F 74 | /compress_t
    [LK-030A] > 65 73 74 5F 30 30 31 2F  74 68 69 6E 67 2F 65 76 | est_001/thing/ev
    [LK-030A] > 65 6E 74 2F 70 72 6F 70  65 72 74 79 2F 70 6F 73 | ent/property/pos
    [LK-030A] > 74 5F 72 65 70 6C 79 22  2C 22 6F 70 65 72 61 74 | t_reply","operat
    [LK-030A] > 69 6F 6E 22 3A 20 22 63  6F 6D 70 72 65 73 73 22 | ion": "compress"
    [LK-030A] > 2C 22 66 6F 72 6D 61 74  22 3A 20 22 67 7A 69 70 | ,"format": "gzip
    [LK-030A] > 22 7D 5D 7D                                      | "}]}   
  • IoT Platform returns a response to the device.

    [1673252441.266][LK-0309] pub: /sys/a1xxxxxxx/compress_test_001/codec/topic/update_reply
    
    [LK-030A] < 7B 22 63 6F 64 65 22 3A  32 30 30 2C 22 6D 65 73 | {"code":200,"mes
    [LK-030A] < 73 61 67 65 22 3A 22 73  75 63 63 65 73 73 22 7D | sage":"success"}
    
    compress update reply code 200, message success
  • The device submits a message to be compressed.

    The log output displays the message to be compressed. If compressed appears in the output, the compression is successful.

    [1673252442.611][LK-0309] pub: /sys/a1xxxxxx/compress_test_001/thing/event/property/post
    
    [LK-030A] > 7B 22 69 64 22 3A 22 31  22 2C 22 76 65 72 73 69 | {"id":"1","versi
    [LK-030A] > 6F 6E 22 3A 22 31 2E 30  22 2C 22 70 61 72 61 6D | on":"1.0","param
    [LK-030A] > 73 22 3A 7B 22 4C 69 67  68 74 53 77 69 74 63 68 | s":{"LightSwitch
    [LK-030A] > 22 3A 30 2C 20 22 6D 65  73 73 61 67 65 22 3A 22 | ":0, "message":"
    [LK-030A] > 74 68 69 73 20 69 73 20  61 20 74 65 73 74 20 6D | this is a test m
    [LK-030A] > 65 73 73 61 67 65 2C 20  74 68 69 73 20 69 73 20 | essage, this is 
    [LK-030A] > 61 20 74 65 73 74 20 6D  65 73 73 61 67 65 2C 20 | a test message, 
    [LK-030A] > 74 68 69 73 20 69 73 20  61 20 74 65 73 74 20 6D | this is a test m
    [LK-030A] > 65 73 73 61 67 65 22 7D  7D                      | essage"}}       
    
    [1673252442.611][LK-2200] compressed [137] --> [103]
  • IoT Platform sends the compressed message.

    The following log output displays the decompressed message. If decompressed appears in the output, the decompression is successful.

    [1673252442.966][LK-2200] decompressed [105] --> [104]
    [1673252442.966][LK-0309] pub: /sys/a1xxxxxxxx/compress_test_001/thing/event/property/post_reply
    
    [LK-030A] < 7B 22 63 6F 64 65 22 3A  32 30 30 2C 22 64 61 74 | {"code":200,"dat
    [LK-030A] < 61 22 3A 7B 7D 2C 22 69  64 22 3A 22 31 22 2C 22 | a":{},"id":"1","
    [LK-030A] < 6D 65 73 73 61 67 65 22  3A 22 73 75 63 63 65 73 | message":"succes
    [LK-030A] < 73 22 2C 22 6D 65 74 68  6F 64 22 3A 22 74 68 69 | s","method":"thi
    [LK-030A] < 6E 67 2E 65 76 65 6E 74  2E 70 72 6F 70 65 72 74 | ng.event.propert
    [LK-030A] < 79 2E 70 6F 73 74 22 2C  22 76 65 72 73 69 6F 6E | y.post","version
    [LK-030A] < 22 3A 22 31 2E 30 22 7D                          | ":"1.0"}        

IoT Platform logs

You can go to the to view logs after you run the sample program.

In the left-side navigation pane, choose Maintenance > Device Log. After you select the product to which the device belongs, you can view logs that contain the message that is submitted by the device.

Note

The logs display the message in garbled characters. This issue occurs because IoT Platform stores the compressed message.

image..png

What to do next

If error messages appear in operation logs, you can resolve the issues by following the instructions in the aiot_compress_api.h file.