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

getAuditConfig(データベースコマンド)

getAuditConfig

バージョン 5.0 の新機能。

getAuditConfig is an administrative command that retrieves audit configurations from mongod and mongos server instances.

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

重要

このコマンドは、MongoDB Atlas クラスターではサポートされていません。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。

このコマンドの構文は、次のとおりです。

db.adminCommand(
{
getAuditConfig: 1
}
)

Auditing must be enabled to use getAuditConfig.

ランタイム監査構成に参加していないノードは、 auditLog.filtersetParameter.auditAuthorizationSuccessの現在の構成ファイル設定を返します。

Nodes that are participating in the runtime audit synthesize their current configuration from memory. Configuration updates are distributed via the oplog mechanism which means updates on mongod nodes are distributed to secondary nodes very quickly. However, the distribution mechanism is different on mongos nodes. mongos nodes have to poll the primary server at regular intervals for configuration updates. You may see stale data due to polling delay if you run setAuditConfig on the primary server and getAuditConfig on a shard before the shard has polled the primary server for updated configuration details.

注意

自動監査スクリプトを作成している場合は、引用符のスタイルとクラスター署名を表すために使用される型が、 mongoshとレガシーのmongo shell では異なることに注意してください。 mongoshでは、型は Binary と Long、Long です。 レガシー shell で対応する型は、BinData と NumberLong です。

// mongosh
signature: {
hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
keyId: Long("0")
}
// mongo
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : Long(0)
}

Run getAuditConfig on the admin database .

db.adminCommand({getAuditConfig: 1})

サンプル サーバーは、読み取りおよび書込み操作を監査するように構成されています。 必要な操作をキャプチャするフィルターがあり、 auditAuthorizationSuccess値はtrueに設定されています。

{
generation: ObjectId("60e73e74680a655705f16525"),
filter: {
atype: 'authCheck',
'param.command': {
'$in': [ 'find', 'insert', 'delete', 'update', 'findandmodify' ]
}
},
auditAuthorizationSuccess: true,
ok: 1,
'$clusterTime': {
clusterTime: Timestamp(1, 1625767540),
signature: {
hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
keyId: Long("0")
}
},
operationTime: Timestamp(1, 1625767540)
}
このページを評価