全部產品
Search
文件中心

:作業記錄

更新時間:Jun 30, 2024

HTTPS接入功能的常式運行後,您可以在裝置端和物聯網平台查看日誌資訊。

前提條件

已配置C Link SDK的HTTPS接入功能常式,詳細資料,請參見使用樣本

裝置端日誌

您可以在裝置端查看運行結果。

  • 串連日誌:

    出現如下日誌,表示裝置與物聯網平台串連成功。

    core_sysdep_network_establish host iot-as-http.cn-shanghai.aliyuncs.com port 443, type 0
    establish tcp connection with server(host='iot-as-http.cn-shanghai.aliyuncs.com', port=[443])
    success to establish tcp, fd=3
    local port: 56028
    [1621563692.299][LK-1000] establish mbedtls connection with server(host='iot-as-http.cn-shanghai.aliyuncs.com', port=[443])
    [1621563692.300][LK-1000] success to establish mbedtls connection, (cost 44722 bytes in total, max used 47410 bytes)
    [1621563692.300][LK-040B] > POST /auth?_v=sdk-c-4.1.0& HTTP/1.1
    [1621563692.300][LK-040B] > Host: iot-as-http.cn-shanghai.aliyuncs.com
    [1621563692.300][LK-040B] > Content-Type: application/json
    [1621563692.300][LK-040B] > Content-Length: 192
    [1621563692.300][LK-040B] >
    [LK-040C] > 7B 22 63 6C 69 65 6E 74  49 64 22 3A 22 61 31 77 | {"clientId":"a1w
    [LK-040C] > 41 66 49 55 6C 41 39 4E  2E 4C 69 67 68 74 53 77 | Af******.LightSw
    [LK-040C] > 69 74 63 68 22 2C 22 73  69 67 6E 6D 65 74 68 6F | itch","signmetho
    [LK-040C] > 64 22 3A 22 68 6D 61 63  73 68 61 32 35 36 22 2C | d":"hmacsha256",
    [LK-040C] > 22 64 65 76 69 63 65 4E  61 6D 65 22 3A 22 4C 69 | "deviceName":"Li
    [LK-040C] > 67 68 74 53 77 69 74 63  68 22 2C 22 70 72 6F 64 | ghtSwitch","prod
    [LK-040C] > 75 63 74 4B 65 79 22 3A  22 61 31 77 41 66 49 55 | uctKey":"a1wAf**
    [LK-040C] > 6C 41 39 4E 22 2C 22 73  69 67 6E 22 3A 22 41 36 | ****","sign":"A6
    [LK-040C] > 43 30 32 31 32 42 44 42  33 39 45 32 36 35 38 39 | C0212BDB39E26589
    [LK-040C] > 36 41 39 41 43 36 34 36  44 33 35 46 39 33 31 43 | 6A9AC646D35F931C
    [LK-040C] > 36 46 35 32 37 36 46 32  41 42 39 33 35 35 33 34 | 6F5276F2AB935534
    [LK-040C] > 30 37 42 31 46 45 33 39  43 31 33 35 37 46 22 7D | 07B1FE39******"}
    [1621563692.377][LK-040D] < HTTP/1.1 200
    [1621563692.377][LK-040D] < Server: nginx/1.14.2
    [1621563692.377][LK-040D] < Date: Fri, 21 May 2021 02:21:32 GMT
    [1621563692.377][LK-040D] < Content-Type: application/json
    [1621563692.377][LK-040D] < Content-Length: 82
    [1621563692.377][LK-040D] < Connection: keep-alive
    [1621563692.377][LK-040D] <
    [LK-040E] < 7B 22 63 6F 64 65 22 3A  30 2C 22 69 6E 66 6F 22 | {"code":0,"info"
    [LK-040E] < 3A 7B 22 74 6F 6B 65 6E  22 3A 22 5E 31 5E 31 36 | :{"token":"^1^16
    [LK-040E] < 32 31 35 36 33 36 39 32  33 36 34 5E 66 33 35 35 | 21563692364^f355
    [LK-040E] < 63 39 30 35 66 37 66 31  37 37 34 22 7D 2C 22 6D | c905f******"},"m
    [LK-040E] < 65 73 73 61 67 65 22 3A  22 73 75 63 63 65 73 73 | essage":"success
    [LK-040E] < 22 7D                                            | "}
    [1621563692.377][LK-0410] {"code":0,"info":{"token":"^1^1621563692364^f355c905f******"},"message":"success"}
    aiot_http_auth succeed
  • 上報訊息日誌:

    串連建立後,以下日誌說明裝置通過Topic,例如/a18wP******/LightSwitch/user/update,向物聯網平台上報了一條訊息。

    [1621563692.377][LK-040B] > POST /topic/a1wAf******/LightSwitch/user/update HTTP/1.1
    [1621563692.377][LK-040B] > Host: iot-as-http.cn-shanghai.aliyuncs.com
    [1621563692.377][LK-040B] > Content-Type: application/octet-stream
    [1621563692.377][LK-040B] > Password: ^1^1621563692364^f355c905f******
    [1621563692.377][LK-040B] > Content-Length: 53
    [1621563692.377][LK-040B] >
    [LK-040C] > 7B 22 69 64 22 3A 22 31  22 2C 22 76 65 72 73 69 | {"id":"1","versi
    [LK-040C] > 6F 6E 22 3A 22 31 2E 30  22 2C 22 70 61 72 61 6D | on":"1.0","param
    [LK-040C] > 73 22 3A 7B 22 4C 69 67  68 74 53 77 69 74 63 68 | s":{"LightSwitch
    [LK-040C] > 22 3A 30 7D 7D                                   | ":0}}
  • 響應日誌:

    以下日誌為物聯網平台收到訊息後,發回至裝置的報文。

    [1621563692.477][LK-040D] < HTTP/1.1 200
    [1621563692.477][LK-040D] < Server: nginx/1.14.2
    [1621563692.477][LK-040D] < Date: Fri, 21 May 2021 02:21:32 GMT
    [1621563692.477][LK-040D] < Content-Type: application/json
    [1621563692.477][LK-040D] < Content-Length: 71
    [1621563692.477][LK-040D] < Connection: keep-alive
    [1621563692.477][LK-040D] <

物聯網平台日誌

您可以在物聯網平台控制台查看裝置的狀態和作業記錄。

  • 線上狀態:

    在左側導覽列,選擇裝置管理 > 裝置,找到裝置,查看裝置狀態。裝置狀態顯示為線上,則表示裝置與物聯網平台成功串連。查看裝置狀態

  • 作業記錄:

    在左側導覽列,選擇監控營運 > Log Service,選擇產品後,查看裝置上線、訂閱Topic和上報訊息的日誌。

    HTTP上報訊息的日誌