Skip to main content
Sumo Logic

Collect RabbitMQ Logs and Metrics for Non-Kubernetes environments

This page explains how to collect RabbitMQ Logs and Metrics for Non-Kubernetes environments.

We use the Telegraf operator for RabbitMQ metric collection and Sumo Logic Installed Collector for collecting RabbitMQ logs. The diagram below illustrates the components of the RabbitMQ collection in a non-Kubernetes environment. Telegraf runs on the same system as RabbitMQ, and uses the RabbitMQ input plugin to obtain RabbitMQ metrics, and the Sumo Logic output plugin to send the metrics to Sumo Logic. Logs from RabbitMQ on the other hand are sent to either a Sumo Logic Local File source.

 

This section provides instructions for configuring metrics collection for the Sumo Logic App for RabbitMQ. Follow the below instructions to set up the metric collection:

  1. Configure Metrics Collection

    1. Configure a Hosted Collector

    2. Configure an HTTP Logs and Metrics Source

    3. Install Telegraf

    4. Configure and start Telegraf

  2. Configure Logs Collection

    1. Configure logging in RabbitMQ

    2. Configure local log file collection

    3. Configure a Collector

    4. Configure a Source

Step 1 Configure Metrics Collection

  1. Configure a Hosted Collector

To create a new Sumo Logic hosted collector, perform the steps in the Configure a Hosted Collector section of the Sumo Logic documentation.

  1. Configure an HTTP Logs and Metrics Source

Create a new HTTP Logs and Metrics Source in the hosted collector created above by following these instructions. Make a note of the HTTP Source URL.

  1. Install Telegraf

Use the following steps to install Telegraf.

  1. Configure and start Telegraf

As part of collecting metrics data from Telegraf, we will use the RabbitMQ input plugin to get data from Telegraf and the Sumo Logic output plugin to send data to Sumo Logic. 

Before you configure telegraf, you will need to enable: Reads metrics from RabbitMQ servers via the Management Plugin.

Enable the RabbitMQ management plugins by running the command below on every node:

 #sudo rabbitmq-plugins enable rabbitmq_management

 #sudo systemctl restart rabbitmq-server

Create or modify telegraf.conf and copy and paste the text below:  

[[inputs.rabbitmq]]
           url = "http://localhost:15672"
           username = "<username_CHANGE_ME>"
           password = "<password_CHANGE_ME>"
           insecure_skip_verify = false
           queue_name_include = []
           queue_name_exclude = []
           [inputs.rabbitmq.tags]
             environment="prod_CHANGE_ME"
             component="messaging"
             messaging_system="rabbitmq"
             messaging_cluster="rabbitmq_onprem_CHANGE_ME"

[[outputs.sumologic]]
  url = "<URL Created in Step b>”
  data_format = "prometheus"

 

Please enter values for the following parameters (marked in bold above):

  • In the input plugins section, which is [[inputs.rabbitmq]]: 

    • url - The URL of the RabbitMQ server for Management HTTP Endpoint. Please see this doc for more information on additional parameters for configuring the RabbitMQ input plugin for Telegraf.

    • username: The Username of RabbitMQ's admin account . The default is “guest”.

    • password:  The password of RabbitMQ's admin account. The default is “guest”.

    • In the tags section, that is [inputs.rabbitmq.tags]

      • environment - This is the deployment environment where the RabbitMQ cluster identified by the value of servers resides. For example: dev, prod or qa. While this value is optional we highly recommend setting it. 

      • messaging_cluster - Enter a name to identify this RabbitMQ cluster. This cluster name will be shown in the Sumo Logic dashboards. 

  • In the output plugins section, that is [[outputs.sumologic]]: 

    • url - This is the HTTP source URL created in step 3. Please see this doc for more information on additional parameters for configuring the Sumo Logic Telegraf output plugin.

Here’s an explanation for additional values set by this Telegraf configuration that we request you please do not modify as they will cause the Sumo Logic apps to not function correctly.

  • data_format - “prometheus” In the output plugins section, which is [[outputs.sumologic]]. Metrics are sent in the Prometheus format to Sumo Logic.

  • component: “messaging” - In the input plugins section, which is [[inputs.RabbitMQ]]. This value is used by Sumo Logic apps to identify application components.

  • messaging_system: “rabbitmq” - In the input plugins sections.In other words, this value identifies the messaging system

For all other parameters please see this doc for more properties that can be configured in the Telegraf agent globally.

Once you have finalized your telegraf.conf file, you can start or reload the telegraf service using instructions from the doc.

  • Once you have finalized your telegraf.conf file, you can start or reload the telegraf service using instructions from the doc.
  • At this point, RabbitMQ metrics should start flowing into Sumo Logic.

Step 2 Configure Logs Collection

This section provides instructions for configuring log collection for RabbitMQ running on a non-kubernetes environment for the Sumo Logic App for RabbitMQ.

By default, RabbitMQ logs are stored in a log file. Sumo Logic supports collecting logs via a local log file. Local log files can be collected via Installed collectors. An Installed collector will require you to allow outbound traffic to Sumo Logic endpoints for collection to work. For detailed requirements for Installed collectors, see this page.

Based on your infrastructure and networking setup choose one of these methods to collect RabbitMQ logs and follow the instructions below to set up log collection:

  1. Configure logging in RabbitMQ

RabbitMQ supports logging via the following methods: local text log files, syslog and stdout. RabbitMQ logs have six levels of verbosity: debug, info, warning, error, critical, none. For details please visit this page. For the dashboards to work properly, must set log level = debug. Default, log level is info.

All logging settings are located in RabbitMQ.conf

  1. Configure RabbitMQ log to a Local file​​​​​

By default, RabbitMQ logs are stored in /var/log/rabbitmq/rabbit@<hostname>.log. The default directory for log files is listed in the RabbitMQ.conf file. 

To configure the log output destination to a log file, use one of the following settings, either in the configuration file.

Edit or create file config: /etc/rabbitmq/rabbitmq.conf following below: 

log.dir = /var/log/rabbitmq

log.file = rabbitmq.log

log.file.level = debug

Logs from the RabbitMQ log file can be collected via a Sumo Logic Installed collector and a Local File Source as explained in the next section.

  1. Configuring a Collector

To add an Installed collector, perform the steps as defined on the page Configure an Installed Collector.

  1. Configuring a Source

To add a Local File Source source for RabbitMQ do the following

To collect logs directly from your RabbitMQ machine, use an Installed Collector and a Local File Source. 

  1. Add a Local File Source.

  2. Configure the Local File Source fields as follows:

  • Name. (Required)

  • Description. (Optional)

  • File Path (Required). Enter the path to your rabbitmq.log. The files are typically located in /var/log/rabbitmq/rabbitmq.log. If you are using a customized path, check the RabbitMQ.conf file for this information. 

  • Source Host. Sumo Logic uses the hostname assigned by the OS unless you enter a different host name

  • Source Category. Enter any string to tag the output collected from this Source, such as RabbitMQ/Logs. (The Source Category metadata field is a fundamental building block to organize and label Sources. For details see Best Practices.)

  • Fields. Set the following fields:

    • component = messaging

    • messaging_system = rabbitmq

    • messaging_cluster = <Your_RabbitMQ_Cluster_Name>

    • environment = <Environment_Name>, such as Dev, QA or Prod.

  1. Configure the Advanced section:

  • Enable Timestamp Parsing. Select Extract timestamp information from log file entries.

  • Time Zone. Choose the option, Ignore time zone from log file and instead use, and then select your RabbitMQ Server’s time zone.

  • Timestamp Format. The timestamp format is automatically detected.

  • Encoding. Select UTF-8 (Default).

  • Enable Multiline Processing. Detect messages spanning multiple lines

    • Infer Boundaries - Detect message boundaries automatically

  1. Click Save.

At this point, RabbitMQ logs should start flowing into Sumo Logic.