Reputation: 4170
I came across an interesting subject when reading the book "RabbitMQ in Action" by Manning. Apparently it's possible to set up consumers to be able to receive all RabbitMQ logging in real time in the consumer.
I read that RabbitMQ publishes logging to an exchange of type topic
called amq.rabbitmq.log
. Consumers can listen to specific severity levels, for example it can be filtered by setting the routing key to error
, warning
or info
.
My question is; I installed a default RabbitMQ server on my PC, but I couldn't find any exchange called amq.rabbitmq.log
. Only one which could be related is amq.rabbitmq.trace
, but this one is used for events (events like queue.deleted, queue.created, ...), in other words that one is not what I'm looking for.
Can anyone bring clarification to my questions? Why is the amq.rabbitmq.log
exchange not available on a clean RabbitMQ server installation?
citation:
Perhaps when you were listing exchanges using rabbitmqctl you spotted an exchange called amq.rabbitmq.log whose type is topic. RabbitMQ will publish its logs to that exchange using the severity level as a routing key - you'll get error, warning and info. Based on what you learned from the previous chapters you can create a consumer to listen to those logs and react accordingly.
Upvotes: 1
Views: 7212
Reputation: 9657
You have to enable it. Create the /etc/rabbitmq/rabbitmq.conf
file and ensure that this line is present in it:
log.exchange = true
I just grepped the source for the rabbitmq.com
website and don't see that setting documented anywhere. If you'd like, file a new issue in that repository and I'll fix it, or open your own PR to do so.
Upvotes: 4
Reputation: 101
It is a bit late, but hope it help someone. So far it works for me. The exchange "amq.rabbitmq.log" will be created automatically by the rabbitmq broker itself. The RabbitMQ broker version that I am using is: 3.8.1
add
log.exchange = true
into your rabbitmq.conf file and restart your rabbitmq service.
You will need to restart your rabbitmq service everytime you had updated the rabbitmq.conf file.
open cmd and enter the following in windows:
Upvotes: 0