Using the rabbitmq_tracing Plug-in
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.
The rabbitmq_shovel plug-in can be enabled only for single-node RabbitMQ instances with SSL disabled, and not for cluster instances or single-node instances with SSL enabled.
Operation Impact
- The tracing log files may use up the disk space. You are advised not to enable the rabbitmq_tracing plug-in for heavy-load instances.
- The disk space occupied by tracing log files is freed only after the plug-in is disabled. Do not enable the plug-in for long term. After the fault is located, close the tracing task and plug-in.
Prerequisites
You have purchased an instance.
Using the rabbitmq_tracing Plug-in
- Enable the rabbitmq_tracing plug-in by referring to Enabling RabbitMQ Plug-ins.
- Log in to the RabbitMQ management UI.
- On the top navigation bar, choose Admin.
- In the navigation tree on the right, choose Virtual Hosts.
Figure 1 Virtual Hosts page
- Click the name of the virtual host to create a trace for.
Figure 2 Virtual host to create a trace for
- In Permissions area, set the guest permission for the user.
Virtual hosts must be configured the guest permission to enable tracing. Otherwise, an error is reported when a trace is created.Figure 3 Granting the guest permission for a virtual host
- In the navigation tree on the right, choose Tracing.
Figure 4 Admin page
- 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
Virtual host
Name of the virtual host.
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 5 Adding a trace
After the trace is created, it is displayed in the All traces area.
Figure 6 Trace list
- (Optional) For a cluster RabbitMQ instance, switch nodes by specifying Node and repeat 8 to create traces for them.
Figure 7 Switching nodes
- After message logs are stored in the trace log file, click the trace log file name to view the log content.
Figure 8 Trace log files
Figure 9 shows the content of delay_exchange_trace.log.
Figure 10 shows the content of delay_queue_trace.log.
Stopping the Tracing Task and Disabling the Plug-in
- In the All traces area on the Tracing page, click Stop to stop the tracing task.
Figure 11 Stopping a tracing task
- Go to the Plug-ins page on the RabbitMQ console, and click Disable next to rabbitmq_tracing. The Disable Plug-in dialog box is displayed.
- Click Yes. The Background Tasks page is displayed. If the task is in the Successful state, the rabbitmq_tracing plug-in is disabled.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot