All Products
Search
Document Center

ApsaraMQ for MQTT:Trace query

Last Updated:Oct 09, 2026

This topic describes how to use the trace query feature of ApsaraMQ for MQTT to troubleshoot device connectivity and message delivery issues. If a device has an abnormal status, use the device trace query to view its connection history. If messages are not sent or received as expected, use the message trace query to view the message trace.

Query a device trace

  1. Log on to the ApsaraMQ for MQTT console. In the top menu bar, select a region, such as China (Hangzhou).

  2. In the navigation pane on the left, click Trace Query.

  3. On the Trace Query page, click the target instance, and then click the Device Trace tab.

  4. In the Client ID text box, select or enter a client ID. The client ID must be in the <groupid>@@@<deviceid> format. Set a time range and click Search.

    Note

    The maximum time range is 1 day.

    Field

    Description

    Time

    The date and time when the action occurred.

    Connection ID

    The connection identity.

    Action

    • connect: The client requests a connection to the server-side.

    • close: The TCP connection is closed.

    • disconnect: The client requests to disconnect from the server-side.

    Description

    • accepted: The server-side accepts the connection request from the client.

    • not authorized: The TCP connection is closed because access to the instance is denied.

    • clientId conflict: The TCP connection is closed because of a client ID conflict.

    • topic auth failed: The TCP connection is closed because access to the topic resource is denied.

    • no heart: The TCP connection is closed due to a heartbeat timeout.

    • closed by client: The TCP connection is closed due to a client-side exception.

      Note

      The client did not send a disconnect message.

    • disconnected by client: The client requests to disconnect.

Query a message trace

  1. Log on to the ApsaraMQ for MQTT console. In the top menu bar, select a region, such as China (Hangzhou).

  2. In the navigation pane on the left, click Trace Query.

  3. On the Trace Query page, click the target instance, and then click the Message Trace tab.

  4. You can query a message trace in one of the following three ways:

    • Combined Query

      Queries the sending and delivery trace of a message based on the client ID, message ID, and a time range.

      Click Combined Query. In the Client ID text box, select or enter a client ID. The client ID must be in the <groupid>@@@<deviceid> format. In the Message ID text box, select or enter the message ID. Set a time range and click Search.

      Note

      The maximum time range is 1 day.

    • Query by Client ID

      Queries the message list for a client based on the client ID and a time range.

      Click Query by Client ID. In the Client ID text box, select or enter a client ID. The client ID must be in the <groupid>@@@<deviceid> format. Set a time range and click Search.

      Note

      The maximum time range is 1 day.

    • Query by Message ID

      Queries the sending and delivery trace of messages based on a message ID and a time range.

      Click Query by Message ID. In the Message ID text box, select or enter the message ID. Set a time range and click Search.

      Note

      The maximum time range is 1 day.

      Field

      Description

      Time

      The date and time when the message was sent or delivered.

      Client IDs

      The IDs of the clients that sent or received the message.

      Description

      • MQTT Client Send: An MQTT client sends a message.

      • Push to MQTT client: The message is delivered to an ApsaraMQ for MQTT client.

      • MQ client sends: An ApsaraMQ for RocketMQ client sends a message.

      • Push offline message to MQTT client: An offline message is delivered to an ApsaraMQ for MQTT client.