Description
DocumentDB audit logs record selected database operations. Profiler logs sample slow operations.
Potential impact
Without the relevant records, unusual access and performance problems are harder to investigate.
Remediation
In the cluster’s attached custom parameter group, select audit events with audit_logs. To profile slow operations, enable profiler and set a threshold and sampling rate. Add the required types to enabled_cloudwatch_logs_exports and check CloudWatch Logs for matching records.
Examples
The examples configure only the exports. Use a managed production credential in place of the sample password and restrict access to the secret and Terraform state.
Before
hcl
resource "aws_docdb_cluster" "example" {
cluster_identifier = "my-docdb-cluster"
engine = "docdb"
master_username = "foo"
master_password = "mustbeeightchars"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
skip_final_snapshot = true
}
After
hcl
resource "aws_docdb_cluster" "example" {
cluster_identifier = "my-docdb-cluster"
engine = "docdb"
master_username = "foo"
master_password = "mustbeeightchars"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
skip_final_snapshot = true
enabled_cloudwatch_logs_exports = ["profiler", "audit"]
}