Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
- RabbitMQ installed and running
- Filebeat OSS version 8.12.1 or lower for collecting logs
- Metricbeat OSS version 8.12.1 or lower for collecting metrics
Why monitor RabbitMQ?
Monitoring RabbitMQ helps you:- Track message rates: Monitor messages published, delivered, and acknowledged to identify throughput issues
- Identify bottlenecks: Detect queues with high message counts or slow consumer rates
- Monitor resource usage: Track memory, disk usage, and connection counts
- Ensure reliability: Alert on message delivery failures or queue buildup
- Optimize performance: Analyze consumer efficiency and message processing times
Setup
You can monitor RabbitMQ by collecting both logs and metrics. For complete observability, set up both Filebeat for logs and Metricbeat for metrics.Collect RabbitMQ logs with Filebeat
Filebeat collects RabbitMQ logs and sends them to Axiom for analysis.Configure RabbitMQ logging
First, ensure RabbitMQ is configured to write logs to a file. Add this to your RabbitMQ configuration file (rabbitmq.conf):
Configure Filebeat
Create or edit yourfilebeat.yml configuration file:
Replace
AXIOM_DOMAIN with api.axiom.co if your organization uses the US region. For more information, see Regions.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Start Filebeat
Collect RabbitMQ metrics with Metricbeat
Metricbeat collects detailed metrics from the RabbitMQ management API.Enable RabbitMQ Management Plugin
The RabbitMQ management plugin exposes metrics through an HTTP API:http://localhost:15672 by default.
Configure Metricbeat
Create or edit yourmetricbeat.yml configuration file:
Replace
AXIOM_DOMAIN with api.axiom.co if your organization uses the US region. For more information, see Regions.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace username and password with your RabbitMQ management credentials.Don’t use the default
guest credentials in production. Create a dedicated monitoring user with read-only permissions.Create a monitoring user (recommended)
For production environments, create a dedicated monitoring user:metricbeat.yml with the monitoring credentials:
Start Metricbeat
Query examples
Once your RabbitMQ data is flowing into Axiom, use these example queries to analyze your message broker:Monitor message rates
Track messages published and consumed over time:Identify problematic queues
Find queues with high message counts that might indicate processing issues:Monitor consumer efficiency
Analyze how quickly consumers are processing messages:Track connection and channel counts
Monitor RabbitMQ connections to detect connection leaks:Analyze error logs
Search RabbitMQ logs for errors and warnings:Troubleshooting
Filebeat can’t access log files
If Filebeat can’t read RabbitMQ logs, ensure proper permissions:Metricbeat connection refused
If Metricbeat can’t connect to the management API:-
Verify the management plugin is enabled:
-
Check if the management port is accessible:
-
Verify RabbitMQ is listening on the correct interface in
rabbitmq.conf:
High memory usage in RabbitMQ
If you notice high memory usage in your metrics:- Check queue depths and message sizes
- Verify consumers are processing messages
- Consider setting memory limits in
rabbitmq.conf:
Best practices
- Monitor both logs and metrics: Logs provide detailed error information while metrics give you performance insights
- Set up alerts: Create monitors in Axiom for critical metrics like queue depth, consumer count, and error rates
- Secure credentials: Use dedicated monitoring users with read-only access instead of admin credentials
- Adjust collection intervals: Balance between data granularity and resource usage by tuning Metricbeat’s
periodsetting - Correlate data: Use the
service: rabbitmqfield to correlate logs and metrics in your queries
Related documentation
- Elastic Beats overview: Learn more about Filebeat and Metricbeat configuration options
- Monitors: Set up alerts for RabbitMQ metrics
- APL Query Language: Learn APL to create powerful RabbitMQ analytics queries