Review DocumentDB log exports

Generate and collect DocumentDB logs needed for audit and performance analysis.

Description

DocumentDB audit logs record selected authentication and database events. Profiler logs sample slow operations.

Potential impact

Missing records can delay investigation of unusual access or slow responses.

Remediation

Select audit events with audit_logs in the cluster’s attached parameter group. For profiling, enable profiler and set the threshold and sampling rate. Add the required types to enabledCloudwatchLogsExports, then check the records, retention and read permissions in CloudWatch Logs.

Examples

Supply docdbPassword as a Pulumi secret, and configure networking and the parameter group separately. Choose skipFinalSnapshot according to your recovery requirements for cluster deletion.

Before

yaml
resources:
  aws:docdb/cluster:
    type: aws:docdb:Cluster
    properties:
      clusterIdentifier: my-docdb-cluster
      engine: docdb
      masterUsername: foo
      masterPassword: ${docdbPassword}
      skipFinalSnapshot: true

After

yaml
resources:
  aws:docdb/cluster:
    type: aws:docdb:Cluster
    properties:
      clusterIdentifier: my-docdb-cluster
      engine: docdb
      masterUsername: foo
      masterPassword: ${docdbPassword}
      skipFinalSnapshot: true
      enabledCloudwatchLogsExports:
        - audit
        - profiler

References