How to Change RabbitMQ Log Level in rabbitmq.config from INFO to ERROR

After you’ve installed RabbitMQ server, if you don’t pay attention, depending on the usage, the log files will get filled-up very quickly.

On my server, within a month, my RabbitMQ server log file reached around 5GB in size.

Log files will be located under $RABBIT_HOME/var/log/rabbitmq directory.

The name of the log file will be “rabbit\@dev-db.log”. dev-db is the name of my server where the RabbitMQ server is running.

In my example, the RABBIT_HOME is /home/rabbitmq_server-3.0.4

1. Example INFO REPORT Log Entries

I had tons of the following “Accepting AMQP connection” and “Closing AMQP connection” “INFO REPORT” messages in my log file.

# cd /home/rabbitmq_server-3.0.4/var/log/rabbitmq

# tail -f rabbit\@dev-db.log
=INFO REPORT==== 19-May-2014::02:08:51 ===
accepting AMQP connection <0.14.5636> (192.168.1.11:14600 -> 192.168.1.5:5672)

=INFO REPORT==== 19-May-2014::02:08:51 ===
closing AMQP connection <0.14.5636> (192.168.1.11:14600 -> 192.168.1.5:5672)

2. Default rabbitmq.conf File

The default RabbitMQ log_level is: [{connection, info}]

We have to change this in the rabbitmq.conf file. But, by default there is no rabbitmq.conf file. The default values such as log_level are built into the rabbitmq server itself.

You can check whether someone already created a rabbitmq.config file on your server, check under the following location: $RABBIT_HOME/etc/rabbitmq/

ls -l /home/rabbitmq_server-3.0.4/etc/rabbitmq/rabbitmq.config

Please note that the location of the rabbitmq.config file is different on different distributions:

  • General UNIX/Linux – $RABBITMQ_HOME/etc/rabbitmq/
  • Debian/Ubuntu – /etc/rabbitmq/
  • Installed from RPM – /etc/rabbitmq/
  • Mac OS X – /opt/local/etc/rabbitmq/
  • Windows – %APPDATA%\RabbitMQ\

3. Set Log Level in RabbitMQ

To fix the above problem, you need to change the log_level in the $RABBIT_HOME/etc/rabbitmq/rabbitmq.config file to errors (instead of the default info).

# cd /home/rabbitmq_server-3.0.4/etc/rabbitmq

# vi rabbitmq.config
[
   {rabbit, [{log_levels,[{connection, error}]}]}
].

Note: Make sure you create the rabbitmq.config file with the exact content mentioned above (including the period at the end).

4. Restart the RabbitMQ Server

For the changes to take effect, restart the RabbitMQ server.

cd /home/rabbitmq_server-3.0.4

sbin/rabbitmqctl stop

sbin/rabbitmq-server -detached

sbin/rabbitmqctl status

After the above, you’ll not see the “=INFO REPORT====” accepting and closing AMQP connection messages in your RabbitMQ log file.