OpenSearch domain error logging to CloudWatch Logs should be enabled
Checks that the OpenSearch domain publishes its error logs to CloudWatch Logs. They carry the warnings and errors OpenSearch raises, such as invalid queries, indexing problems and snapshot failures, which help with security and access audits and with diagnosing availability issues.
- service
- Opensearch
- severity
- Medium
- scope
- evaluated in every region
How to fix it
In the console
OpenSearch Service → Domains → the domain → Logs
- Error logs
- Enabled
- CloudWatch log group
- A new log group, or an existing one kept for this domain's error logs
- Access policy
- One letting es.amazonaws.com call logs:CreateLogStream and logs:PutLogEvents on the log group
With the AWS CLI
aws opensearch update-domain-config --domain-name <domain-name> --log-publishing-options 'ES_APPLICATION_LOGS={CloudWatchLogsLogGroupArn=<log-group-arn>,Enabled=true}' --region <region>With Terraform
- Overwrites existing settings: log_publishing_options blocks are the domain's whole set in Terraform, so a log type left out is turned off; keep a block for every log already published.
resource "aws_opensearch_domain" "this" {
domain_name = var.domain_name
log_publishing_options {
log_type = "ES_APPLICATION_LOGS"
cloudwatch_log_group_arn = var.log_group_arn
}
}
See which of your accounts this check is failing on.
Book a live scan