> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Export Logs to Google Cloud Storage

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:

  - `mongod`

  - `mongos`

  - `mongod-audit`

  - `mongos-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](https://www.mongodb.com/docs/atlas/cluster-additional-settings.md#std-label-database-log-redaction) before exporting logs, contact [MongoDB Support](https://support.mongodb.com/welcome).

## Required Access

To export logs to an Google Cloud Storage bucket, you must have [`Project Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Owner) or [`Organization Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-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.

1. 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](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsettings%2FgroupSettings) page displays.

2. In Atlas, go to the Project Integrations page.

   Click the Integrations tab.

   The [Project Integrations](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fintegrations) page displays.

3. Click Configure on the Google Cloud Storage Log Monitoring card.

4. 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.](https://www.mongodb.com/docs/atlas/security/set-up-gcp-access.md#std-label-manage-gcp-access)

   Click Next.

5. 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 a `logs` directory 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 [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) server 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 [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) that 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 [`mongos`](https://www.mongodb.com/docs/manual/reference/program/mongos.md#mongodb-binary-bin.mongos) router 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 [`mongos`](https://www.mongodb.com/docs/manual/reference/program/mongos.md#mongodb-binary-bin.mongos) router processes, recording the same kinds of audited system events but from the router's perspective in a sharded deployment.

   - Events Events from the Project Activity
     Feed, such as integration lifecycle events and log export status changes. To learn more, see [Export Activity Feed Events to External Tools.](https://www.mongodb.com/docs/atlas/export-events.md#std-label-export-events)

   To learn more about MongoDB logs, see [View and Download MongoDB Logs.](https://www.mongodb.com/docs/atlas/mongodb-logs.md#std-label-mongodb-logs)

   To learn more, see [View and Download MongoDB Logs.](https://www.mongodb.com/docs/atlas/mongodb-logs.md#std-label-mongodb-logs)

   Click Next.

6. Assign an access policy to your Google Cloud Storage IAM (Identity and Access Management) role.

   Follow the Google Cloud Console or Atlas CLI steps outlined in the Atlas UI.

   Click Validate to confirm your configuration and credentials are correct before enabling the export.

7. Click Done.

## Alerting for Log Export Failures

Atlas automatically notifies you when log exports fail or recover through [default alerts](https://www.mongodb.com/docs/atlas/configure-alerts.md#std-label-default-alert-settings) that are enabled for all projects.

### Default Alerts

The following alerts are enabled by default for all projects with External Log Sinks:

- [`Log export has failed. Check your integration settings and credentials.`](https://www.mongodb.com/docs/atlas/reference/alert-conditions.md#mongodb-alert-Log-export-has-failed.-Check-your-integration-settings-and-credentials.)

- [`Log export is failing after multiple attempts. Logs are being queued and will be sent once the connection is restored.`](https://www.mongodb.com/docs/atlas/reference/alert-conditions.md#mongodb-alert-Log-export-is-failing-after-multiple-attempts.-Logs-are-being-queued-and-will-be-sent-once-the-connection-is-restored.)

- [`Log export replay has failed to deliver records to an external platform, even after an automatic replay attempt. These records will be permanently deleted once their retention window expires. Contact MongoDB Support to request redelivery.`](https://www.mongodb.com/docs/atlas/reference/alert-conditions.md#mongodb-alert-Log-export-replay-has-failed-to-deliver-records-to-an-external-platform--even-after-an-automatic-replay-attempt.-These-records-will-be-permanently-deleted-once-their-retention-window-expires.-Contact-MongoDB-Support-to-request-redelivery.)

These alerts are informational, which means when the alert condition is met, Atlas immediately sends email notifications to all users with the [`Project Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Owner) role and logs the alert to the Project Activity Feed. These alerts don't appear on the Open Alerts or Closed Alerts tabs of the Project Alerts page. You can customize the notification recipients and methods in the Project Alerts settings. To learn more about the informational alert lifecycle, see [Alerts Workflow.](https://www.mongodb.com/docs/atlas/alerts.md#std-label-alerts-workflow)

### 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.](https://www.mongodb.com/docs/atlas/tutorial/activity-feed.md#std-label-activity-feed)

For more information about configuring alert notifications, see [Configure an Alert.](https://www.mongodb.com/docs/atlas/configure-alerts.md#std-label-configure-alert-settings)
