Review DocumentDB audit and profiler logging

Configure both DocumentDB audit or profiler log generation and CloudWatch export to retain the records needed for investigation.

Description

Use DocumentDB audit logs to investigate authentication and database operations, and profiler logs to find slow operations. CloudTrail separately records AWS management API calls.

Potential impact

Gaps in either log can make it harder to trace unusual access or a slowdown.

Remediation

  1. Select audit events with audit_logs in a custom parameter group attached to the cluster. For profiling, enable profiler and set the threshold and sampling rate.
  2. Add the required types to enableCloudwatchLogsExports. Check CloudWatch Logs for a selected audit event or sampled slow operation.
  3. Restrict log access, set retention and review costs and profiling overhead.

Examples

The manifests select the exports. Configure the parameter group and remaining cluster settings separately.

Before

yaml
apiVersion: docdb.aws.crossplane.io/v1alpha1
kind: DBCluster
spec:
  forProvider:
    region: us-east-1
    engine: docdb

After

yaml
apiVersion: docdb.aws.crossplane.io/v1alpha1
kind: DBCluster
spec:
  forProvider:
    region: us-east-1
    engine: docdb
    enableCloudwatchLogsExports:
      - audit
      - profiler

References