Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read and log RabbitMQ message content?

Tags:

rabbitmq

I am sending a message to rabbitMQ, I want to read this message and log it into a file. How can I do this?

like image 837
MassiveData Avatar asked Mar 14 '15 18:03

MassiveData


People also ask

How do I access RabbitMQ logs?

RabbitMQ Debian and RPM packages will set up logrotate to run weekly on files located in default /var/log/rabbitmq directory. Rotation configuration can be found in /etc/logrotate. d/rabbitmq-server.

How do I check RabbitMQ logs in Windows?

The default location for RabbitMQ logs on Windows can be found here: Default Locations on Windows. rabbitmqctl commands can be collected using rabbitmqctl. bat, located in the rabbitmq_server-<version>\sbin directory.


1 Answers

In order to trace all the messages being exchanged on the RabbitMQ server you can use the firehose tracer.

You can activate/deactivate it with the commands:

rabbitmqctl trace_on
rabbitmqctl trace_off

Once activated, all the messages will be duplicated to the exchange amq.rabbitmq.trace.

Just bind a queue to it and consume from there. You can find a working example in our RabbitMQ Cookbook.

It should also be possible to directly trace the messages to file by using the rabbitmq_tracing plugin, but I have never tried it actually.

like image 66
Sigi Avatar answered Oct 08 '22 19:10

Sigi