AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

AWS S3 バケットへのログのエクスポート

You can configure your M10+ Atlas clusters to export system logs every minute to an AWS S3 bucket.

この統合により、次のことが可能になります。

  • S3バケットにエクスポートするMongoDBログファイルを指定します。 Atlas は次のログタイプのエクスポートをサポートしています。

    • mongod

    • mongos

    • mongod-audit

    • mongos-audit

  • 最大 10 エクスポート パスを設定すると、複数のAWS S3 バケットにログを同時にエクスポートできます。

  • CRAP ARN との統合を構成して、S3マルチリージョン アクセス ポイント(CRAP)にログを送信します。現在、Atlas Administration APIを使用してのみ CRAP ARN を構成できます。 CRAP エイリアスはサポートされていません。

重要

ログには機密情報が含まれる場合があります( PII など)。 AWS S3バケット内のログのストレージと処理はユーザーがする必要があります。ログをエクスポートする前に Atlas が特定の情報をリダクションするには、 MongoDBサポート にお問い合わせください。

AWS S3バケットにログをエクスポートするには、Atlas に対する Project Owner または Organization Owner アクセス権が必要です。

  • 各 Atlas ホストは通常、1 日あたり 1 GBのログを生成します。ログをエクスポートするには、 データ転送コストが発生します。具体的なデータ転送コストは、 宛先、リージョン、クラウドプロバイダーによって異なります。

  • ネットワークの問題または再試行により、 AWS S3バケットに重複するログエントリが発生する可能性があります。

  • AWS IAM ロールと S3バケットは同じAWSアカウントに属している必要があります。

次のものが必要です。

  • sts:AssumeRole を持つAWS IAM ロール。これにより、Atlas はAWSリソースにアクセスでき、最大セッション期間は 12 時間に設定されます。

  • An existing AWS S3 bucket.

  • MongoDB 7.0 以降を実行中M10+ Atlas クラスター。

AWS S3バケットにログをエクスポートするには、次の手順を実行します。

1
  1. まだ表示されていない場合は、希望するプロジェクトを含む組織を選択しますナビゲーション バーのOrganizationsメニュー

  2. まだ表示されていない場合は、ナビゲーション バーのProjectsメニューから目的のプロジェクトを選択します。

  3. サイドバーで、 アイコンを Project Overview の横にあるをクリックします。

[ Project Settings ]ページが表示されます。

2

[Integrations] タブをクリックします。

プロジェクト統合ページが表示されます。

3
4
  1. Authorize an AWS IAM Role ドロップダウンから ARN を選択します。ARN を追加するには、「 統合AWSアクセスのセットアップ 」を参照してください。

  2. [Next] をクリックします。

5
  1. Bucket Nameフィールドに、 AWSアカウントに表示される S3バケットの名前を入力します。

  2. Prefixフィールドにディレクトリ名を入力して、 S3バケットの内容を整理します。例、logs/ と入力すると、エクスポートされたログを保存するための S3バケットに logsディレクトリが作成されます。

  3. [Log Type で、エクスポートするログのタイプを選択します。

    • MongoDB Logs Diagnostic logs written by each 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 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 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 router processes, recording the same kinds of audited system events but from the router's perspective in a sharded deployment.

    詳しくは、MongoDBログの表示とダウンロードを参照してください。

  4. (任意) S3バケット内のログを暗号化する場合は、 KMS KeyフィールドにAWS KMS(Key Management Service)キー ARN を入力します。詳細については、 「 AWS KMS によるカスタマー キーの管理 」を参照してください。

  5. [Next] をクリックします。

6
  1. Click to copy the access policy generated by Atlas and save it locally with the file name: AtlasS3LogExportPolicy.

  2. Click をクリックして Atlas によって生成された CLI コマンドをコピーし、ターミナルでコマンドを実行して、アクセス ポリシーをあなたの AWS IAM ロールにアタッチします。

  3. エクスポートを有効にする前に、Validate をクリックして、構成と認証情報が正しいことを確認してください。

7

Atlas は、 構造化メタデータを持つJSONオブジェクトとして S3バケットにログをエクスポートします。各ログエントリには、元のMongoDBログメッセージとソースクラスター、ホスト、およびログタイプを識別する追加のコンテキスト フィールドが含まれます。

エクスポートされたログは、レガシーの Push-Based Log Export (PBLE) システムとは異なる構造化された形式を使用します。この新しい形式により、ログインフラストラクチャ内でのログのルーティング、フィルター、分析のためのメタデータが強化されます。

エクスポートされた各ログエントリは、次のトップレベルフィールドを持つ JSON オブジェクトです。

フィールド
説明

service.name

サービスの種類を識別する string。デフォルトは mongodb に設定されます。

log

JSON エンコードされた string としての元の MongoDB ログ メッセージ。これには、MongoDB からの構造化されたログ データが含まれています。これには、t (タイムスタンプ)、s (重要度)、c (コンポーネント)、id (メッセージ ID)、ctx (コンテキスト)、msg (メッセージ テキスト)、attr (属性)などのフィールドが含まれています。

host.name

ログエントリを生成したMongoDBホストの完全修飾ドメイン名(例:atlas-cluster-shard-00-00.example.mongodb.net)。

mongodb.group.id

クラスターを含む Atlas プロジェクト ID(グループ ID とも呼ばれる)。

mongodb.cluster.name

Atlas が使用する内部クラスター識別子。

mongodb.customer.cluster.name

Atlas UI に表示されるユーザー定義のクラスター名。

mongodb.log.type

エクスポートされるログの種類。指定できる値: mongodmongosmongod-auditmongos-audit

timestamp

ログ エントリが生成された時の ISO 8601 タイムスタンプ。

次の例は、一般的なエクスポートされたログエントリを示しています。

{
"service.name": "mongodb",
"log": "{\"t\":{\"$date\":\"2026-05-19T21:58:00.309+00:00\"},\"s\":\"I\",\"c\":\"NETWORK\",\"id\":6723804,\"ctx\":\"conn928\",\"msg\":\"Ingress TLS handshake complete\",\"attr\":{\"durationMillis\":26}}",
"host.name": "atlas-cluster-shard-00-00.nzmz4k.mongodb.net",
"mongodb.group.id": "682f18ee72a6a02c8182cab3",
"mongodb.cluster.name": "atlas-cluster",
"mongodb.customer.cluster.name": "Cluster0",
"mongodb.log.type": "mongod",
"timestamp": "2026-05-19T21:58:00.309Z"
}

The log field contains the original MongoDB log message. When parsed, it reveals the standard MongoDB log message structure:

{
"t": {"$date": "2026-05-19T21:58:00.309+00:00"},
"s": "I",
"c": "NETWORK",
"id": 6723804,
"ctx": "conn928",
"msg": "Ingress TLS handshake complete",
"attr": {
"durationMillis": 26
}
}

注意

attr オブジェクト内のフィールドの順序は、ログエントリによって異なり、レガシー PBLE 形式とは異なる場合があります。ログ解析ツールは、attr 内のフィールドの順序に依存する必要はありません。

外部ログシンク形式には、レガシーの Push-Based Log Export (PBLE) システムからの変更が多く含まれています。

変更
説明

ネストされたログコンテンツ

MongoDB ログ メッセージは、トップ レベルではなく、JSON エンコードされた string として log フィールドの下にネストされるようになりました。これには、ログ メッセージ フィールドを抽出するための追加の JSON 解析ステップが必要です。

追加のメタデータ フィールド

新しいトップレベルフィールドにより、ログソースに関するコンテキストが提供されます: service.namehost.namemongodb.group.idmongodb.cluster.namemongodb.customer.cluster.namemongodb.log.typetimestamp

ログエントリの順序

S3 に表示されるログエントリの順序は PBLE と異なる場合があります。時間分析のためにログエントリの順序に依存しないでください。正確な時間ベースのプロセシングには、 log コンテンツ内の timestamp フィールドまたは t.$date フィールドを使用します。

属性フィールドの順序付け

attrオブジェクト内のフィールドの順序はPBLEと異なる場合があります。フィールドの順序に依存せず、attrをJSONオブジェクトとしてパースします。

エクスポートされたログをプロセシングする場合:

  • 2 段階の JSON パース: まず外部 JSON オブジェクトをパースしてメタデータ フィールドにアクセスし、次に logフィールドを JSON としてパースして MongoDB ログ メッセージにアクセスします。

  • フィールドの抽出:特定のMongoDBログフィールド(msgcattrなど)を抽出するには、まず logフィールドを解析します。

  • タイムスタンプ処理: トップレベルの timestamp フィールドは ISO 8601 形式を使用しますが、log コンテンツ内の t.$date フィールドは MongoDB の拡張 JSON 形式を使用する場合があります。どちらも同じ時間を表します。

  • クラスター識別: mongodb.customer.cluster.name を使用して、Atlas UI に表示されるクラスター名でログをフィルターします。mongodb.cluster.name フィールドには内部識別子が含まれています。

Atlas automatically notifies you when log exports fail or recover through default alerts that are enabled for all projects.

次のアラートは、 外部ログ シンク を持つすべてのプロジェクトでデフォルトで有効になっています。

These alerts are informational, which means when the alert condition is met, Atlas immediately sends email notifications to all users with the 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.

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.