You can configure your M10+ Atlas clusters to export system logs every minute to an Google Cloud Storage bucket.
This integration allows you to:
Specify which MongoDB log files you want to export to the Google Cloud Storage bucket. Atlas supports exporting the following log types:
mongodmongosmongod-auditmongos-audit
Set up to 10 export paths, allowing you to export logs to multiple Google Cloud Storage buckets simultaneously.
Important
Logs can contain sensitive information (including PII). You are responsible for the storage and treatment of your logs in your Google Cloud Storage bucket. To have Atlas redact certain information before exporting logs, contact MongoDB Support.
Required Access
To export logs to an Google Cloud Storage bucket, you must have Project Owner or Organization Owner access to Atlas.
Considerations
Each Atlas host typically produces 1 GB of logs per day. Exporting logs incurs a data transfer cost. The exact data transfer cost varies depending on the destination, region, and cloud provider.
Network issues or retries can cause duplicate log entries in your Google Cloud Storage bucket.
Prerequisites
You'll need:
An existing Google Cloud Storage bucket.
A Google Cloud Storage account authorized for Atlas access.
An
M10+Atlas cluster running MongoDB 7.0 or later.
Procedure
To export logs to a Google Cloud Storage bucket, complete the following steps.
In Atlas, go to the Project Settings page.
If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
In the sidebar, click the icon next to Project Overview.
The Project Settings page displays.
In Atlas, go to the Project Integrations page.
Click the Integrations tab.
The Project Integrations page displays.
Grant Atlas access to your Google Cloud Storage account.
From the Service Account dropdown, select the Google Cloud Service Account for Atlas to write logs to your Google Cloud Storage bucket.
To add a Service Account, see Set Up and Manage Google Cloud Service Account Access.
Click Next.
Connect Atlas to your Google Cloud Storage bucket.
In the Bucket Name field, enter the name of your Google Cloud Storage storage bucket as it appears in your Google Cloud account.
In the Prefix path field, enter a directory name to organize the contents of your Google Cloud Storage storage bucket. For example, entering
logs/creates alogsdirectory in your Google Cloud Storage storage bucket to store the exported logs.Under Log Type, select the types of logs you want to export.
MongoDB Logs Diagnostic logs written by each
mongodserver process. They record server startup and shutdown, configuration, connections, slow queries, replication, sharding activity, and other operational events.MongoDB Audit Logs Auditing logs emitted by
mongodthat track system event actions such as authentication attempts, authorization checks, role changes, and other security-relevant operations. These logs are separate from the main MongoDB log.MongoDB Router Logs Diagnostic logs written by each
mongosrouter process in a sharded cluster. They capture router-specific behavior such as routing of queries to shards, sharding metadata refreshes, and general process diagnostics.MongoDB Router Audit Logs Auditing logs emitted by
mongosrouter processes, recording the same kinds of audited system events but from the router's perspective in a sharded deployment.
To learn more, see View and Download MongoDB Logs.
To learn more, see View and Download MongoDB Logs.
Click Next.
Alerting for Log Export Failures
Atlas automatically notifies you when log exports fail or recover through default alerts that are enabled for all projects.
Default Alerts
The following alerts are enabled by default for all projects with External Log Sinks:
All alerts send email notifications to all users with the Project Owner role and appear in the Project
Activity Feed. You can customize the notification recipients and methods in the Project Alerts settings.
Activity Feed Events
In addition to alerts, Atlas logs the following informational events to the Project Activity Feed:
Log export has recovered. Queued logs are ready to resume sending.
Log export has recovered. Queued logs are now being sent.
All queued logs have been delivered to sink.
To view these events, see View Activity Feed.
For more information about configuring alert notifications, see Configure an Alert.