Updated on 2023-08-18 GMT+08:00

Querying Messages

Scenario

You can view the offset of different partitions, the message size, creation time, and body of messages in topics.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Application > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
  4. Click the desired Kafka instance to view the instance details.
  5. Click the Message Query tab. Then specify the topic name, partition, and the search method.

    If no partition is specified, messages in all partitions of the topic are displayed.

    You can search by the following methods:

    • Creation time: Search by the time that messages are created.
    • Offset: Search by the message position.

    If a topic contains a large amount of data, an internal service error may be reported when you query messages in a topic with only one replica. You can shorten the time range for query based on the data volume.

  6. Click Search to query messages.

    The query result is as follows.

    Figure 1 Querying topic messages

    Parameter description:

    • Topic Name: name of the topic where the message is located
    • Partition: partition where the message is located
    • Offset: position of the message in the partition
    • Message Size (Byte) size of the message
    • Created: time when the message is created. The message creation time is specified by CreateTime when a producer creates messages. If this parameter is not set during message creation, the message creation time is year 1970 by default.

  7. Click View Message Body. In the displayed View Message Body dialog box, view the message content, including the topic name, partition, offset, creation time, and message body.

    The console displays messages smaller than 4 KB. To view messages larger than 4 KB, click Download Message.

  8. (Optional) To restore the default settings, click Reset.