RabbitMQ Logging
RabbitMQ generates detailed logs that record broker activity, errors, warnings, and connection events. Reading and configuring these logs is essential for debugging problems, auditing access, and understanding what your broker is doing under the hood.
Default Log File Locations
Linux: /var/log/rabbitmq/rabbit@<hostname>.log macOS: /opt/homebrew/var/log/rabbitmq/rabbit@<hostname>.log Windows: C:\Users\<User>\AppData\Roaming\RabbitMQ\log\rabbit@<hostname>.log
Replace <hostname> with your machine's hostname. Run hostname in a terminal to find it. RabbitMQ may also create a rabbit@<hostname>_upgrade.log file during upgrades.
Viewing Logs in Real Time
# Linux / macOS sudo tail -f /var/log/rabbitmq/rabbit@$(hostname).log # Windows (PowerShell) Get-Content "C:\Users\YourUser\AppData\Roaming\RabbitMQ\log\rabbit@HOSTNAME.log" -Wait
Log Levels
RabbitMQ log messages have severity levels. From most to least severe:
critical – Broker is about to crash or has a serious problem error – Something went wrong that needs immediate attention warning – Something unexpected happened but the broker continues info – Normal operational events (connections, queue declarations) debug – Detailed internal events for troubleshooting
The default log level is info. This records connections, disconnections, queue and exchange declarations, and errors — everything you need for normal operations.
Configuring Log Level
Set the log level in rabbitmq.conf:
log.console.level = info log.file.level = warning
This example logs info and above to the console but only warning and above to the log file. Reducing the file log level keeps log files smaller in high-traffic environments.
To enable debug logging temporarily (do not leave this on in production — it generates enormous log files):
rabbitmqctl set_log_level debug
Revert to info level:
rabbitmqctl set_log_level info
Log Categories
RabbitMQ organises log output into categories. You can set different log levels per category:
log.connection.level = info # connection/disconnection events log.channel.level = warning # channel-level events log.queue.level = info # queue declarations and deletions log.mirroring.level = warning # classic queue mirroring events log.federation.level = warning # federation plugin events log.upgrade.level = info # upgrade events
Set these in rabbitmq.conf to fine-tune which categories produce verbose output.
Common Log Messages and What They Mean
Connection Accepted
[info] <0.1234.0> accepting AMQP connection <0.1234.0> (127.0.0.1:54321 -> 127.0.0.1:5672)
A client has opened a new AMQP connection. Normal operational event.
Connection Closed
[info] closing AMQP connection <0.1234.0> (127.0.0.1:54321 -> 127.0.0.1:5672, vhost: '/', user: 'guest')
Client closed the connection cleanly. Normal.
Unexpected Connection Closure
[warning] closing AMQP connection <0.1234.0> ... connection_closed_abruptly
The client disconnected without sending a proper close frame. This often indicates a client crash or network problem. Investigate why the client disconnected unexpectedly.
Memory Alarm
[warning] vm_memory_monitor: memory alarm set. Publishers will be blocked.
RabbitMQ has hit its memory high watermark. All publishers are now blocked. Action required: reduce queue depths or increase available RAM.
Disk Alarm
[warning] disk monitor: disk alarm set. Publishers will be blocked.
Free disk space has fallen below the minimum threshold. Free up disk space immediately.
Queue Created
[info] <0.1234.0> queue 'order-queue' in vhost '/' declared, ...
A queue was declared. Normal operational event.
Authentication Failure
[warning] <0.1234.0> PLAIN login refused: user 'alice' - invalid credentials
A client tried to connect with the wrong password. Monitor for repeated authentication failures — they may indicate a brute-force attack.
Log Rotation
RabbitMQ supports log rotation via the rabbitmqctl rotate_logs command or by sending a SIGHUP signal to the broker process. Integrate with logrotate on Linux for automatic daily rotation:
# /etc/logrotate.d/rabbitmq
/var/log/rabbitmq/*.log {
daily
rotate 14
compress
missingok
notifempty
postrotate
/usr/sbin/rabbitmqctl rotate_logs
endscript
}
Sending Logs to a Central System
Use a log shipper like Filebeat, Fluentd, or Logstash to forward RabbitMQ log files to a centralised logging platform such as Elasticsearch, Splunk, or CloudWatch. This lets you search, alert on, and correlate RabbitMQ logs with logs from other services.
Summary
RabbitMQ logs live in the /var/log/rabbitmq/ directory on Linux. The default log level is info, which records connections, queue declarations, and errors. Adjust log levels per category in rabbitmq.conf to control verbosity. Watch for memory alarm, disk alarm, and authentication failure log entries as they signal urgent action is needed. Configure log rotation to prevent log files from filling your disk. Ship logs to a central system for long-term storage and cross-service correlation.
