Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log all Rabbit MQ messages?

Tags:

We're using a RabbitMQ server for messaging between applications. We have a need to create a central log for all amqp messages coming into the Rabbit server. Our purpose is not temporary debugging, but rather auditability. Ideally, I'd be able to log to a specified file to begin with, and later log to an external system such as Logly or Splunk.

I've explored turning on Firehose and using the tracing plugin, but the queues in question are not durable. I'm also not sure if these solutions will work if new queues and exchanges are added to the virtual host after logging hast started. These tools seem designed more for temporary debugging that what I need.

I'd love to hear your ideas. At this point I'm worried I'll have to setup a network monitor to intercept and log the messages before they reach Rabbit.

like image 605
Chris McKenzie Avatar asked Nov 12 '13 18:11

Chris McKenzie


People also ask

How do I track messages on RabbitMQ?

To actually trace messages a RabbitMQ user needs to bind a queue (this is the destination of the traced messages) to the amq. rabbitmq. trace exchange and use the appropriate routing key based on what we want to trace: # trace every message sent to any exchange and delivered by any queue.

How do I check my 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.

Where are RabbitMQ logs stored?

By default, RabbitMQ logs are stored in /var/log/rabbitmq/rabbit@<hostname>. log . The default directory for log files is listed in the RabbitMQ. conf file.

How do I get RabbitMQ queue messages?

Get request to retrieve messages, it must send a new request each time it wants to receive a message, even if there are multiple messages in the queue. If the queue you're retrieving a message from has a message pending when issuing a Basic. Get , RabbitMQ responds with a Basic. GetOk RPC response (figure 5.2).


1 Answers

Why would you say that the firehose won't work? You can create the queues for listening as you want, i.e.: durable and so on. Then if you need every message, you can do a binding using the # character.

See: http://www.rabbitmq.com/firehose.html

Performance will drop as explained, but I wouldn't ditch the solution without testing performance.

like image 85
old_sound Avatar answered Dec 12 '22 16:12

old_sound