Pricing Login
Interactive demos

Click through interactive platform demos now.

Live demo, real expert

Schedule a platform demo with a Sumo Logic expert.

Start free trial
Back to blog results

February 24, 2022 By Sumo Logic

How to monitor ActiveMQ logs and metrics

ActiveMQ is a message-oriented middleware, which means that it is a piece of software that handles messages across applications. It acts as a broker that can help facilitate asynchronous communication patterns like publish-subscribe and message queues. The main goal of those servers is to create a scalable and reliable message bus that different components can use to communicate with each other.

ActiveMQ competes with similar brokers like RabbitMQ and Kafka, and although it’s not as widely adopted as the former tools, it has many uses in the enterprise world.

In this post, we will explain how to monitor ActiveMQ logs and metrics using Sumo Logic Cloud SIEM. Then, we’ll walk you through the process of installing and configuring a sample ActiveMQ server using Docker. Finally, we will show you how to install both Hosted and Installed Sumo Logic Collectors, then configure monitoring and alerting for them.

Let’s get started.

Setting up an ActiveMQ cluster

In this section, we will show you how to install and set up an ActiveMQ cluster using Docker.

ActiveMQ is a classic Java-based distributed system that implements JMS. Before you set up monitoring on it, you must configure it properly with the correct settings and permission levels. We will deploy an ActiveMQ cluster using Docker in this tutorial, but note that the process of deploying it in a dedicated virtual machine (VM) is similar.

First, we need a stable Docker image. We’ll use the rmohr/activemq (safe link) image, which follows the traditional approach of downloading the release jars and running the standalone server.

The default ActiveMQ configuration will not be enough to expose monitoring via JMX for our Collectors, so we’ll need a way to configure it. We’ll use the Docker host to copy the configuration and data from the Docker image, then configure it appropriately and start the server with that config.

Start with running a shell inside the container:

$ docker run --user root --rm -ti \

-v $(pwd)/conf:/mnt/conf \

-v $(pwd)/data:/mnt/data \

rmohr/activemq:5.15.9 /bin/bash

$ root@ecefc320f4b1:/opt/apache-activemq-5.15.9#

With this command, you share the /conf and /data folders on the host filesystem with the /mnt/conf and /mnt/data inside the container (respectively). We use that to copy the configuration files to their destinations, as follows:

$ chown activemq:activemq /mnt/conf

$ chown activemq:activemq /mnt/data

$ cp -a /opt/activemq/conf/* /mnt/conf/

$ cp -a /opt/activemq/data/* /mnt/data/


Now that we’ve copied the config and data into the host, we are ready to configure them. Edit the following activemq.xml file and enable JMX metrics for it:


<broker> xmlns="" brokerName="localhost" dataDirectory="${}" useJmx="true"</broker>

You might also need to expose JMX if you want to inspect the container using Jconsole from within your host. You will need to start the container with some Java configuration values:

export ACTIVEMQ_SUNJMX_START=" \ \ \ \ \

-Djava.rmi.server.hostname=activemq \ \"

Those are the standard flags that we need to use to connect to JMX metrics within Docker. In a production environment, you might want to limit this for localhost and use authenticated credentials.

Now, start the container and expose the necessary ports:

$ docker run -p 61616:61616 -p 8161:8161 -p 1099:1099 —-name=activemq -e ACTIVEMQ_SUNJMX_START=${ACTIVEMQ_SUNJMX_START} \

-v $(pwd)/conf:/opt/activemq/conf \

-v $(pwd)/data:/opt/activemq/data \


You should be able to see logs that show important information about the server status in the console:

INFO | For help or more information please see:

INFO | No Spring WebApplicationInitializer types detected on classpath

INFO | ActiveMQ WebConsole available at

INFO | ActiveMQ Jolokia REST API available at

INFO | Initializing Spring FrameworkServlet 'dispatcher'

INFO | No Spring WebApplicationInitializer types detected on classpath

INFO | jolokia-agent: Using policy access restrictor classpath:/jolokia-access

You can access the exposed Jolokia REST API at to make sure that it responds with information:

Figure 1.1 – An ActiveMQ Jolokia REST API

You can also connect to the exposed JMX endpoint using JConsole:

$ jconsole

Then, use the following connection string which points to the jmx rmi service:


Figure 1.2 ActiveMQ Jconsole Access

When successful, you should be able to inspect the JVM metrics:

Figure 1.3 – ActiveMQ JConsole Metrics

Now we are ready to start collecting logs using the Sumo Logic Hosted Collector.

Setting up a Hosted Collector for Collecting ActiveMQ Metrics

In this section, we will show you how to use a Hosted Collector for collecting ActiveMQ metrics.

Hosted Collectors are basically predefined URLs hosted by Sumo Logic that we use to send data from various services. They can create and handle thousands of requests per second based on your account plan. You’ll use Hosted Collectors in combination with Telegraf agents, which you will also need to install in your system.

First, you need to create a new Collector for ActiveMQ events using the Sumo Logic UI. Follow the steps outlined here and add the necessary metadata fields. The figure below shows what we filled in:

Figure 1.4 – Our New ActiveMQ Hosted Collector Form

If you save the form, you will be prompted to add a source for the Collector. Select “HTTP Logs and Metrics” and fill in the following fields:

Figure 1.5 – New ActiveMQ HTTP Logs and Metrics

Once saved, the form should give you a unique URL. You will need that URL for the Telegraf config, so be sure to save it temporarily.

Now, we need to create a config file for the Telegraf agent. We’ll use the following standard config and fill in the values for our server and metadata fields:


mount_points = ["/"]







urls = ["http://localhost:8161/api/jolokia"]

name_prefix = "activemq_"

username = "admin"

password = "admin"







name = "OperatingSystem"

mbean = "java.lang:type=OperatingSystem"


name = "jvm_runtime"

mbean = "java.lang:type=Runtime"

paths = ["Uptime"]


name = "jvm_memory"

mbean = "java.lang:type=Memory"


name = "jvm_garbage_collector"

mbean = "java.lang:name=*,type=GarbageCollector"

paths = ["CollectionCount"]

tag_keys = ["name"]


name = "queue"

mbean = "org.apache.activemq:brokerName=*,destinationName=*, destinationType=Queue,type=Broker"

tag_keys = ["brokerName","destinationName"]


name = "topic"

mbean = "org.apache.activemq:brokerName=*,destinationName=*, destinationType=Topic,type=Broker"

tag_keys = ["brokerName","destinationName"]


name = "broker"

mbean = "org.apache.activemq:brokerName=*,type=Broker"

tag_keys = ["brokerName"]



data_format = "prometheus"

Now you can start the agent. You should be able to inspect the logs and verify that it can send data to the output URL:

$ telegraf --debug --config telegraf.conf

2022-01-18T11:55:45Z I! Starting Telegraf 1.21.2

2022-01-18T11:55:45Z D! [agent] Successfully connected to outputs.sumologic

2022-01-18T11:55:45Z D! [agent] Starting service inputs

While we are sending metrics with our Hosted Collector, we can also show you how to set up an Installed Collector for logs.

Setting up an Installed Collector for collecting ActiveMQ logs

In this section, we will show you how to use an Installed Collector for collecting ActiveMQ logs.

As the name implies, an Installed Collector is a collector that is installed on your host. It serves the ActiveMQ broker and is used for collecting application logs and events which it sends directly to Sumo Logic.

To begin, you need to install the Collector on your platform by following these steps. You will need to create access credentials for it, which you can do on the “Preferences” page.

When you’re finished, you need to use the UI to create a new local file source for ActiveMQ. You can use the following figure to fill in the form:

Figure 1.6 – New ActiveMQ Local File Source

You will need to make sure that you point to the correct logs file (which we already shared with the host in the /data folder when we created the container). In our example, it’s inside:


While you are there, you can change the file to enable debug logging:



Now, give it some time or create topics and messages using the management UI located at so that you can populate some event logs. After a while, you should be able to see them in your Sumo Logic Logs Dashboard:

Figure 1.7 Logged Events from an ActiveMQ Hosted Collection

Now that we have configured logging for logs and metrics, we need to start setting up specialized monitors for ActiveMQ that will help us trigger alerts in case some predefined thresholds are exceeded.

Setting up monitoring for ActiveMQ

In this section, we will show you how to create monitoring rules for ActiveMQ. The following steps are mainly taken from this documentation page. You can install predefined monitors using the UI’s import option. When you copy the JSON file (and before you save it), you want to modify the following keys and fill in the values of the cluster that we just created:




Once they’re imported, you want to enable each individual monitor:

Figure 1.8 – List of ActiveMQ Monitors

With the monitors in place, you should be able to receive event alerts from monitoring the ActiveMQ cluster. You might also consider installing the dedicated ActiveMQ app for better visibility.

Sumo Logic apps are custom dashboards built for specific server components and common use cases. You can install AcitveMQ from the app catalog page, available on the web or to customers from our product. When you install ActiveMQ, you can specify the usual data filters related to our cluster:





Then, you should be able to view and explore the status of your ActiveMQ cluster in detail using the dedicated dashboard.

Figure 1.9 - The ActiveMQ - Overview dashboard gives you an at-a-glance view of your ActiveMQ deployment across brokers, queues, topics and messages.

Next steps

Using Sumo Logic for monitoring and alerting enables you to utilize a single platform to troubleshoot a wide variety of issues with applications in real time. In this article, we showed you how easy it is to set up monitoring and alerts on enterprise application servers like ActiveMQ, and we also explained how to use apps to gain a detailed overview of the server activities.

If you’d like to start using Sumo Logic to start making sense of all your data, click here to give it a try.

Complete visibility for DevSecOps

Reduce downtime and move from reactive to proactive monitoring.

Sumo Logic cloud-native SaaS analytics

Build, run, and secure modern applications and cloud infrastructures.

Start free trial

Sumo Logic

More posts by Sumo Logic.

People who read this also enjoyed