Skip to main content
Collect logs from a self-hosted MongoDB server — connections, slow queries, replication, and errors — with the OpenTelemetry Collector. The same Collector can also forward traces and metrics from your apps — see Connect OpenTelemetry Collector to Bronto.

Prerequisites

Configure the Collector

MongoDB 4.4+ writes one structured JSON object per line. Parse it with the json_parser operator:
/etc/otel/config.yaml
Set <REGION> to eu or us.

Metrics

The Collector Contrib mongodb receiver collects operation, connection, memory, cache, replication, and database metrics:
Add this receiver to the Bronto metrics pipeline. Use a monitoring user and check the Collector Contrib MongoDB receiver documentation for authentication options and measurements available from your MongoDB version.

What you will see in Bronto

Open Search and filter by service.name = mongodb. Each entry carries a timestamp (t), severity (s), component (c — e.g. NETWORK, QUERY, REPL), context (ctx), and message (msg); slow operations include the command, namespace, and durationMillis under attr. The json_parser promotes these to searchable fields.

Troubleshooting

  • Older MongoDB (pre-4.4) writes plain text, not JSON. Drop the json_parser operator and let Bronto’s Custom Parser extract fields server-side.
  • Log volume: raising systemLog.verbosity greatly increases output — keep it low in production.
  • For general issues, see OTel Collector troubleshooting.

Alternative: Fluent Bit

If you already run Fluent Bit, tail the MongoDB log file and forward it over HTTP:
fluent-bit.conf
Set Format to json_lines, not json. See Connect Fluent Bit to Bronto for installation.