Description
INDEX_SLOW_LOGS and SEARCH_SLOW_LOGS publish indexing and search operations that exceed shard slow-log thresholds. A per-index threshold of -1, the default, disables the corresponding slow log.
Potential impact
Without these records, it is harder to identify which shard searches or writes took too long.
Remediation
Enable a log_publishing_options block for each required type and allow service writes in the CloudWatch Logs resource policy. Set per-index thresholds for your workload and verify an operation that exceeds one. Restrict log access and retention for sensitive content, and monitor volume and cost.
Examples
The excerpts show only the publishing block. Supply the required domain settings and the destination log group.
Before
resource "aws_elasticsearch_domain" "example" {
log_publishing_options {
cloudwatch_log_group_arn = aws_cloudwatch_log_group.example.arn
log_type = "ES_APPLICATION_LOGS"
enabled = true
}
}
After
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
}
}
The second excerpt replaces ES_APPLICATION_LOGS with INDEX_SLOW_LOGS. To keep error logs, retain their block and add the indexing slow-log block. Search slow logs need their own block.