Skip to main content
Sumo Logic

Collect ActiveMQ Logs and Metrics for Non-Kubernetes environments

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

This section provides instructions for configuring metrics collection for the Sumo Logic App for ActiveMQ. 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 ActiveMQ
    2. Configure local log file collection
    3. Configure a Collector
    4. Configure a Source

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.

  2. 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.

  3. Install Telegraf
    Use the following steps to install Telegraf.

  4. Configure and start Telegraf
    As part of collecting metrics data from Telegraf, we will use the Jolokia2 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 :

  1. Enable reads metrics from ActiveMQ servers via the JMX MBeans by setting “useJmx=true” in file config ActiveMQ.xml

<broker useJmx="true" brokerName="BROKER1">

 ...

</broker>

  1. Disable strict-checking by editing file jolokia-access.xml

Navigate to directory : 

<Folder ActiveMQ Installed>/webapps/api/WEB-INF/classes/

Open file jolokia-access.xml,and comment or remove section below:

<cors>

<strict-checking/>

</cors>

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

 [[inputs.disk]]
   mount_points = ["/"]
   [inputs.disk.tags]
        environment="dev"
        component="messaging"
        messaging_system="activemq"
        messaging_cluster="activemq_CHANGE_ME"

 [[inputs.jolokia2_agent]]
   urls = ["http://localhost:8161/api/jolokia"]
   name_prefix = "activemq_"
   username = "<username_CHANGE_ME>"
   password = "<password_CHANGE_ME>"
   [inputs.jolokia2_agent.tags]
        environment="dev"
        component="messaging"
        messaging_system="activemq"
        messaging_cluster="activemq__CHANGE_ME"

  [[inputs.jolokia2_agent.metric]]
        name  = "OperatingSystem"
        mbean = "java.lang:type=OperatingSystem"

  [[inputs.jolokia2_agent.metric]]
        name  = "jvm_runtime"
        mbean = "java.lang:type=Runtime"
        paths = ["Uptime"]

  [[inputs.jolokia2_agent.metric]]
        name  = "jvm_memory"
        mbean = "java.lang:type=Memory"
  [[inputs.jolokia2_agent.metric]]
        name = "jvm_garbage_collector"
        mbean = "java.lang:name=*,type=GarbageCollector"
        paths = ["CollectionCount"]
        tag_keys = ["name"]

  [[inputs.jolokia2_agent.metric]]
        name = "queue"
        mbean = 
        "org.apache.activemq:brokerName=*,destinationName=*,
        destinationType=Queue,type=Broker"
        tag_keys = ["brokerName","destinationName"]

  [[inputs.jolokia2_agent.metric]]
        name = "topic"
        mbean = 
        "org.apache.activemq:brokerName=*,destinationName=*,
        destinationType=Topic,type=Broker"
        tag_keys = ["brokerName","destinationName"]

  [[inputs.jolokia2_agent.metric]]
        name = "broker"
        mbean = "org.apache.activemq:brokerName=*,type=Broker"
        tag_keys = ["brokerName"]
  [[outputs.sumologic]]
  url = "<URL Created in Step b_CHANGE_ME>”
    data_format = "prometheus"

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

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

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

    • username: The Username of ActiveMQ’s admin account . The default is “admin”.

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

    • In the tags section, which is [inputs.jolokia2_agent.tags]

      • environment - This is the deployment environment where the ActiveMQ 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 ActiveMQ cluster. This cluster name will be shown in the Sumo Logic dashboards. 

  • In the output plugins section, which 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.jolokia2_agent]]. This value is used by Sumo Logic apps to identify application components.

  • messaging_system: “activemq” - 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.

At this point, ActiveMQ metrics should start flowing into Sumo Logic.

Step 2 Configure Logs Collection

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

By default, ActiveMQ 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 ActiveMQ logs and follow the instructions below to set up log collection:

  1. Configure logging in ActiveMQ

ActiveMQ use Log4j for logging, it supports logging via the following methods: local text log files, syslog,stdout, remote storage.ActiveMQ logs have eight levels of verbosity: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL. 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 log4j.properties

  1. Configure ActiveMQ to log to a Local file

By default, ActiveMQ logs are stored in <Folder ActiveMQ Installed>/data/activemq.log. The default directory for log files is listed in the log4j.properties file. 

To configure the log output destination to a log file:

  • Navigate to directory : <Folder ActiveMQ Installed>/conf

  • Open file log4j.properties and edit options below: 

log4j.appender.logfile.file=${activemq.data}/activemq.log

log4j.appender.logfile.maxFileSize=10240MB

log4j.logger.org.apache.activemq=DEBUG

Logs from the ActiveMQ 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 ActiveMQ do the following

To collect logs directly from your ActiveMQ 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 activemq.log. The files are typically located in <Folder ActiveMQ Installed>/data/activemq.log. If you are using a customized path, check the log4j.properties 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 ActiveMQ/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 = activemq

    • messaging_cluster = <Your_ActiveMQ_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 ActiveMQ 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, ActiveMQ logs should start flowing into Sumo Logic.