1

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.

Ozkan
  • 3,880
  • 9
  • 47
  • 78

2 Answers2

3

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.


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Luke Bakken
  • 8,993
  • 2
  • 20
  • 33
  • What is the difference between the event exchange plugin and the above-mentioned configuration? – bumblebee Sep 17 '19 at 04:17
  • @Luke, configuration is done, but the exchange is still not created. I can't create it manually either, I get `access refused` when I try to create an exchange named `amq.rabbitmq.log`. Anything I'm forgetting? – Ozkan Sep 17 '19 at 09:38
  • Update: I found more information here: https://github.com/rabbitmq/rabbitmq-server/issues/1973. I think I need to update to the latest RabbitMQ version. I'm on 3.7.14 right now. – Ozkan Sep 17 '19 at 09:58
  • @Ozkan I think you didn't understand my question. RabbitMQ provides a plugin called the `evet_exchange` plugin which can be used to consume RabbitMQ events related to queues, exchanges, connections, users and many more. What is the difference between the logs consumer and the events consumer? As far as I know, these logs are same as the events that are generated. – bumblebee Sep 17 '19 at 10:07
  • @bumblebee You still didn't read my question completely right :), `amq.rabbitmq.log` is for pure logging. `event_exchange` is as you said. Look for amq.rabbitmq.trace in my question – Ozkan Sep 17 '19 at 10:51
  • @Ozkan - yes you'll need a more recent version. Sorry for the confusion. I forgot that we had to fix that "recently". – Luke Bakken Sep 17 '19 at 15:11
0

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:

  1. rabbitmq-service stop
  2. rabbitmq-service install
  3. rabbitmq-service start
  4. rabbitmqctl start_app
xXSnowBunny
  • 81
  • 1
  • 6