OpenSearch and Elasticsearch slow logs not configured

Configure search and indexing slow logs needed for performance analysis.

Description

Search and indexing slow logs record shard operations that exceed per-index thresholds. Use separate audit logs to track user activity.

Potential impact

Without slow logs, it is harder to identify which searches or writes account for a delay.

Remediation

In LogPublishingOptions, enable SEARCH_SLOW_LOGS for searches and INDEX_SLOW_LOGS for indexing as needed. Allow service writes to each destination group and set thresholds on the relevant indexes. Check that an operation exceeding its threshold appears in the corresponding group.

Examples

The excerpts change both publishing settings on AWS::Elasticsearch::Domain. Supply DomainName and the log groups. AWS::OpenSearchService::Domain supports the same options.

Before

yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Slow-log publishing example
Resources:
  ElasticsearchDomain:
    Type: "AWS::Elasticsearch::Domain"
    Properties:
      DomainName:
        Ref: DomainName
      LogPublishingOptions:
        SEARCH_SLOW_LOGS:
          CloudWatchLogsLogGroupArn: >-
            arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-slow-logs
          Enabled: "false"
        INDEX_SLOW_LOGS:
          CloudWatchLogsLogGroupArn: >-
            arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-index-slow-logs
          Enabled: "false"

After

yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Slow-log publishing example
Resources:
  ElasticsearchDomain:
    Type: "AWS::Elasticsearch::Domain"
    Properties:
      DomainName:
        Ref: DomainName
      LogPublishingOptions:
        SEARCH_SLOW_LOGS:
          CloudWatchLogsLogGroupArn: >-
            arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-slow-logs
          Enabled: "true"
        INDEX_SLOW_LOGS:
          CloudWatchLogsLogGroupArn: >-
            arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-index-slow-logs
          Enabled: "true"

References