Updated on 2023-07-20 GMT+08:00

Using the rabbitmq_tracing Plug-in

Scenario

The rabbitmq_tracing plug-in provides the message tracing function. It traces incoming and outgoing messages of RabbitMQ, captures the messages, and saves message logs to the corresponding trace file.

Prerequisites

You have purchased an instance.

Procedure

  1. Enable the rabbitmq_tracing plug-in by referring to Enabling Plug-ins.
  2. Log in to the RabbitMQ management UI.
  3. On the top navigation bar, choose Admin.
  4. In the navigation tree on the right, choose Tracing.

    Figure 1 Admin page

  5. In the Add a new trace area, set the following parameters and click Add trace to add a trace.

    Table 1 Trace parameters

    Parameter

    Description

    Name

    Name of the trace.

    Format

    Format of the output message log. Text (easy to read) and JSON (easy to parse) are supported.

    Tracer connection username

    Name of the user that creates tracing.

    Tracer connection password

    Password of the user that creates a trace.

    Max payload bytes

    Maximum size of a message, in bytes.

    Assume that Max payload bytes is set to 10. A message larger than 10 bytes will be truncated when it is transferred through RabbitMQ. For example, trace test payload will become trace test after truncation.

    Pattern

    Matching pattern. Options:

    • #: Trace all messages entering and leaving RabbitMQ.
    • publish#: Trace all messages entering RabbitMQ.
    • deliver#: Trace all messages leaving RabbitMQ.
    • publish.delay_exchange: Trace messages entering a specified exchange. delay_exchange indicates an exchange name. Change it to the actual value.
    • deliver.delay_queue: Trace messages entering a specified queue. delay_queue indicates a queue name. Change it to the actual value.
    Figure 2 Adding a trace

    After the trace is created, it is displayed in the All traces area.

    Figure 3 Trace list

  6. (Optional) For a cluster RabbitMQ instance, switch nodes by specifying Node and repeat 5 to create traces for them.

    Figure 4 Switching nodes

  7. After message logs are stored in the trace log file, click the trace log file name to view the log content.

    Figure 5 Trace log files

    Figure 6 shows the content of delay_exchange_trace.log.

    Figure 6 delay_exchange_trace.log

    Figure 7 shows the content of delay_queue_trace.log.

    Figure 7 delay_queue_trace.log