For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tomcat

The Apache Tomcat source collects metrics from a Tomcat server over JMX and reads its access and catalina log files. Metrics are scraped through the OpenTelemetry JMX metrics gathering jar against an enabled JMX remote endpoint, while logs are read from the configured file paths and optionally parsed into structured fields.

Supported Telemetry Types

Platform
Metrics
Logs
Traces

Linux

Windows

macOS

Prerequisites

For metrics, the target Tomcat JVM must have JMX remote enabled and reachable from the collector host. Enable it by adding the JMX flags to CATALINA_OPTS (typically in setenv.sh / setenv.bat), for example:

-Dcom.sun.management.jmxremote.port=9012
-Dcom.sun.management.jmxremote.rmi.port=9012
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Set com.sun.management.jmxremote.rmi.port explicitly so the port is fixed (otherwise the JMX adaptor picks one at random, which breaks firewall configuration). The collector host must be able to reach the configured address and port. See the official Monitoring and Managing Tomcat documentation for details. The collector also requires the OpenTelemetry JMX metrics jar to be installed at the configured jar path.

For logs, Tomcat must be writing the relevant files and the collector must run where it can read those paths (or the files must be shipped to it). Access logging is produced by Tomcat's Access Log Valve, configured in server.xml; see the official Valve Component reference. The default paths read by this source are /usr/local/tomcat/logs/localhost_access_log.*.txt for access logs and /usr/local/tomcat/logs/catalina.out for catalina logs. Adjust them to match your installation.

Configuration

Bindplane docs - Apache Tomcat - image 1

General

Parameter
Type
Required
Default
Description

Choose Telemetry Type

Telemetry Selector

No

["Logs", "Metrics"]

Which signals this source collects: Logs, Metrics, or both. Parameters below are relevant only when their signal is selected.

Logs

Parameter
Type
Required
Default
Description

Access Logs

Boolean

No

true

Enable collection of Tomcat access logs.

Access Log Path(s)

Strings

Yes

/usr/local/tomcat/logs/localhost_access_log.*.txt

File paths to access logs. Relevant when Access Logs is enabled.

Catalina Logs

Boolean

No

true

Enable collection of Tomcat catalina logs.

Catalina Log Path(s)

Strings

Yes

/usr/local/tomcat/logs/catalina.out

File paths to catalina logs. Relevant when Catalina Logs is enabled.

Metrics

Parameter
Type
Required
Default
Description

Address

String

No

localhost

IP address or hostname to scrape for Tomcat metrics.

Port

Integer

No

9012

Port to scrape for Tomcat metrics.

Advanced

Parameter
Type
Required
Default
Description

Parse To

Enum: body, attributes

No

body

Parse structured log parts to either body or attributes. Relevant when Logs is selected.

Start At

Enum: beginning, end

No

end

Start reading logs from beginning or end. Relevant when Logs is selected.

Timezone

Timezone

No

UTC

The timezone to use when parsing log timestamps. Relevant when Logs is selected.

Parse

Boolean

No

true

Parses the log fields into structured data. Relevant when Logs is selected.

JMX Metrics Collection Jar Path

String

No

/opt/opentelemetry-java-contrib-jmx-metrics.jar

Full path to the JMX metrics jar. Relevant when Metrics is selected.

Collection Interval

Integer

No

60

How often (seconds) to scrape for metrics. Relevant when Metrics is selected.

Examples

Collect metrics and logs from a local Tomcat

This source scrapes JMX metrics from a Tomcat server on localhost:9012 and reads both the access and catalina logs from their default locations.

Configuration Tips

  • The JMX Port (default 9012) must match the com.sun.management.jmxremote.port value set in CATALINA_OPTS. Set the RMI port to the same value to keep it fixed.

  • If JMX authentication or TLS is enabled on Tomcat, configure the JMX gathering jar accordingly; the defaults assume authenticate=false and ssl=false.

  • Use the telemetry-type selector to scope the source: disable Metrics if you only ship logs, or disable Logs (or one of the access/catalina toggles) if you only want metrics.

Troubleshooting

No metrics appear

Symptoms: the source produces no Tomcat metrics.

Solutions:

  1. Confirm JMX remote is enabled in CATALINA_OPTS and that Tomcat was restarted after the change.

  2. Verify the configured Address and Port match the JMX/RMI port and that the collector host can reach it.

  3. Confirm the JMX metrics jar exists at the configured jar path.

Connection refused

Symptoms: the collector logs a connection error when scraping.

Solutions:

  1. Check that the JMX port is listening and not blocked by a firewall.

  2. Ensure com.sun.management.jmxremote.rmi.port is set so the port stays fixed.

No logs appear

Symptoms: access or catalina logs are not collected.

Solutions:

  1. Verify the configured log paths exist and that the collector user can read them.

  2. Confirm the Access Log Valve is configured in server.xml so access logs are being written.

  3. If logs are being written but not parsed as expected, check that Parse is enabled and the log format matches.

Standalone Source

Last updated

Was this helpful?