Review Elasticsearch log publishing

Enable CloudWatch publishing for the Elasticsearch domain logs you need.

Description

Domain errors, slow searches and slow indexing use different log types. Select the types needed to investigate your workload.

Potential impact

Without indexing slow logs, it is harder to identify which writes caused a delay.

Remediation

In log_publishing_options, set the destination group ARN, log_type and enabled = true. Allow service writes in the log group’s resource policy. For slow logs, set thresholds on the relevant indexes and confirm that an operation exceeding its threshold appears in the group.

Examples

The second excerpt enables only INDEX_SLOW_LOGS publishing. Supply the referenced log group and required domain settings, including the domain name. Configure additional log types separately.

Before

hcl
resource "aws_elasticsearch_domain" "example" {
  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.example.arn
    log_type                 = "INDEX_SLOW_LOGS"
    enabled                  = false
  }
}

After

hcl
resource "aws_elasticsearch_domain" "example" {
  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.example.arn
    log_type                 = "INDEX_SLOW_LOGS"
    enabled                  = true
  }
}

References