All Products
Search
Document Center

IoT Platform:Message tracing

Last Updated:Dec 21, 2023

The device log feature of IoT Platform allows you to view the traces of device messages. You can trace the transmission of a message in IoT Platform based on the trace ID or message ID. You can also analyze and resolve issues based on faulty nodes. This topic describes how to view message traces.

Procedure

  1. Log on to the IoT Platform console.

  2. On the Overview page, click All environment. On the All environment tab, find the instance that you want to manage and click the instance ID or instance name.

  3. In the left-side navigation pane, choose Maintenance > Device Log. On the Cloud run log tab, find the trace ID or message ID of the message trace that you want to view.
  4. Click the Message Trajectory tab. In the search box, enter the trace ID or message ID.
  5. Click the Search icon on the right and view the message tracing map.
    • A message tracing map consists of communication nodes and connection lines. The nodes and lines in green indicate that the communication is successful. The nodes and lines in red indicate that the communication fails.
    • You can move the pointer over a communication node to view the communication time, success message, or failure cause.
    For example, you can configure the following data forwarding rule for a household thermostat after it submits data to IoT Platform:

    Use the following SQL statement for data processing:

    SELECT 
    items.temperature.value as temperature, 
    items.humidity.value as humidity,
    deviceName() as deviceName,
    timestamp() as time 
    FROM "/g***/TH_sensor/thing/event/property/post"

    Add operations to forward the temperature, humidity, deviceName, and time data:

    • Insert data into Tablestore: Set the primary key to ${deviceName}.
    • Publish data to a subscribed Advanced Message Queuing Protocol (AMQP) consumer group: Select the default consumer group.
    • Insert data into ApsaraDB RDS: Make sure that the time field in the database table is set as the auto-increment primary key.
    • Publish data to another topic: Enter /g***/TH_sensor/user/update.

    For more information, see Configure a data forwarding rule.

    After the device submits data, you can view the message tracing map and the results of data forwarding operations.

    • In the map, the republish, ots, and amqp nodes are green. The message is published to another topic, inserted into Tablestore, and published to the subscribed AMQP consumer group.
    • In the map, the tsdb in vpc and rds nodes are red. The message fails to be stored to the time series and spatial-temporal database in the instance due to invalid parameters and fails to be inserted into ApsaraDB RDS due to abnormal service configuration.

What to do next

When you find processing failure nodes in a message tracing map, you need to troubleshoot the issues based on the failure cause. For more information about the troubleshooting methods, see the description of error codes in IoT Platform logs.

To resolve the issues in the preceding message tracing map, you can choose Rules > Data Forwarding in the console, find the data forwarding rule based on the rule name, and then modify the following data forwarding operations:

  • Insert data into ApsaraDB RDS: Make sure that the time field in the database table is not the primary key.

After the device submits data again, you can view the message tracing map. The message is forwarded to all nodes.