Skip to main content
TL;DRCollect and visualize MongoDB server logs (4.4+ JSON format) in ClickStack using the OTel filelog receiver. Includes a demo dataset and pre-built dashboard.

Integration with existing MongoDB

This section covers configuring your existing MongoDB installation to send logs to ClickStack by modifying the ClickStack OTel collector configuration. If you would like to test the MongoDB integration before configuring your own existing setup, you can test with our preconfigured setup and sample data in the “Demo dataset” section.

Prerequisites

  • ClickStack instance running
  • Existing self-managed MongoDB installation (version 4.4 or newer)
  • Access to MongoDB log files
1

Verify MongoDB logging configuration

MongoDB 4.4+ outputs structured JSON logs by default. Check your log file location:
Common MongoDB log locations:
  • Linux (apt/yum): /var/log/mongodb/mongod.log
  • macOS (Homebrew): /usr/local/var/log/mongodb/mongo.log
  • Docker: Often logged to stdout, but can be configured to write to /var/log/mongodb/mongod.log
If MongoDB is logging to stdout, configure it to write to a file by updating mongod.conf:
After changing the configuration, restart MongoDB:
2

Create a custom OTel collector configuration for MongoDB

ClickStack allows you to extend the base OpenTelemetry Collector configuration by mounting a custom configuration file and setting an environment variable. The custom configuration is merged with the base configuration managed by ClickStack UI via OpAMP.Create a file named mongodb-monitoring.yaml with the following configuration:
  • You only define new receivers and pipelines in the custom config. The processors (memory_limiter, transform, batch) and exporters (clickhouse) are already defined in the base ClickStack configuration — you just reference them by name.
  • This configuration uses start_at: beginning to read all existing logs when the collector starts. For production deployments, change to start_at: end to avoid re-ingesting logs on collector restarts.
3

Configure ClickStack to load custom configuration

To enable custom collector configuration in your existing ClickStack deployment, you must:
  1. Mount the custom config file at /etc/otelcol-contrib/custom.config.yaml
  2. Set the environment variable CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml
  3. Mount your MongoDB log directory so the collector can read them
Update your ClickStack deployment configuration:
Ensure the ClickStack collector has appropriate permissions to read the MongoDB log files. In production, use read-only mounts (:ro) and follow the principle of least privilege.
4

Verify Logs in ClickStack UI

Once configured, log into ClickStack UI and verify that logs are flowing:
MongoDB logs search view
MongoDB log detail view

Demo dataset

Test the MongoDB integration with a pre-generated sample dataset before configuring your production systems.
1

Download the sample dataset

Download the sample log file:
2

Create test collector configuration

Create a file named mongodb-demo.yaml with the following configuration:
3

Run ClickStack with demo configuration

Run ClickStack with the demo logs and configuration:

Verify logs in ClickStack UI

Once ClickStack is running:
  1. Open ClickStack UI and log in to your account (you may need to create an account first)
  2. Navigate to the Search view and set the source to Logs
  3. Set the time range to include 2026-03-09 00:00:00 - 2026-03-10 00:00:00 (UTC)
MongoDB logs search view
MongoDB log detail view

Dashboards and visualization

1

Download the dashboard configuration

.
2

Import pre-built dashboard

  1. Open ClickStack UI and navigate to the Dashboards section.
  2. Click “Import Dashboard” in the upper right corner under the ellipses.
Import Dashboard
  1. Upload the mongodb-logs-dashboard.json file and click finish import.
Finish importing MongoDB logs dashboard
3

The dashboard will be created with all visualizations pre-configured

For the demo dataset, set the time range to include 2026-03-09 00:00:00 - 2026-03-10 00:00:00 (UTC).
MongoDB logs dashboard

Troubleshooting

No logs appearing in ClickStack UI

Verify the effective config includes your filelog receiver:
Check for errors in the collector logs:

Logs not parsing correctly

Verify MongoDB is outputting JSON logs (4.4+):
If the output is not valid JSON, your MongoDB version may be using the legacy text log format (pre-4.4). You’ll need to replace the json_parser operator with a regex_parser, or upgrade to MongoDB 4.4+.

Next steps

  • Set up alerts for critical events (error spikes, slow query thresholds)
  • Create additional dashboards for specific use cases (replica set monitoring, connection tracking)

Going to production

This guide extends ClickStack’s built-in OpenTelemetry Collector for quick setup. For production deployments, we recommend running your own OTel Collector and sending data to ClickStack’s OTLP endpoint. See Sending OpenTelemetry data for production configuration.