全部产品
Search
文档中心

阿里云物联网平台:运行日志

更新时间:Jul 07, 2023

数据压缩的例程运行后,您可以在设备端和物联网平台查看日志信息。

前提条件

已配置C Link SDK的数据压缩例程,详细信息,请参见使用示例

设备端日志

您可以在设备端查看运行结果。

  • 连接日志。

    出现如下日志,表示设备与物联网平台连接成功。

    [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
  • 设备订阅上报结果回复的Topic。

    [1673252440.111][LK-0309] sub: /sys/a1xxxxxx/compress_test_001/codec/topic/update_reply
    suback, res: -0x0000, packet id: 1, max qos: 1
  • 设备上报Topic列表。

    [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                                      | "}]}   
  • 物联网平台返回上报结果。

    [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
  • 设备上报压缩消息。

    日志输出是压缩前的报文,日志中有compressed表示已完成压缩。

    [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]
  • 物联网平台下发压缩消息。

    日志输出是解压后的报文,日志中有decompressed表示报文已完成解压缩。

    [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"}        

物联网平台日志

您可以在,查看例程运行后的日志信息。

在左侧导航栏,选择监控运维 > 日志服务,选择产品后,查看设备上报消息日志。

说明

日志中展示的消息为乱码,是因为物联网平台保存的是压缩后的消息内容。

log

后续步骤

运行日志中出现的错误信息,请参见aiot_compress_api.h中的状态码描述,根据提示解决问题。