Description
Elasticsearch and OpenSearch domains have separate log types for slow searches, slow indexing, engine errors and audit events.
Potential impact
A missing log type can leave you without the records needed to investigate a delay or identify who performed an operation.
Remediation
In logPublishingOptions, choose each required type and destination group ARN, then set enabled to true. Allow the service to write to the group and set retention. For slow logs, set per-index thresholds. For audit logs, enable fine-grained access control and auditing for the required categories. Verify an event of the selected type reaches its group.
Examples
The excerpts show parts of the same exampleDomain. Add the second excerpt’s publishing option to the existing engine and cluster settings, and supply the referenced log group.
Before
resources:
exampleDomain:
type: aws:elasticsearch:Domain
properties:
elasticsearchVersion: "7.10"
clusterConfig:
instanceType: t2.small.elasticsearch
instanceCount: 1
After
resources:
exampleDomain:
type: aws:elasticsearch:Domain
properties:
logPublishingOptions:
- cloudwatchLogGroupArn: ${exampleLogGroup.arn}
logType: INDEX_SLOW_LOGS
enabled: true
INDEX_SLOW_LOGS publishes only indexing operations that exceed a configured threshold.