Checks if error logs from Elasticsearch domains are being sent to CloudWatch Logs, aiding in monitoring and diagnosing issues.
Rule | Elasticsearch domain error logging to CloudWatch Logs should be enabled |
Framework | AWS Foundational Security Best Practices |
Severity | ✔ Medium |
Rule Description
Enabling error logging for an Elasticsearch domain in AWS to CloudWatch Logs is essential for monitoring and troubleshooting purposes, as well as for compliance with AWS Foundational Security Best Practices. By configuring this setting, any errors or issues that occur within the Elasticsearch domain will be logged to CloudWatch Logs for easy review and analysis.
Troubleshooting Steps
If there are issues with enabling error logging to CloudWatch Logs for the Elasticsearch domain, follow these troubleshooting steps:
Check IAM permissions: Ensure that the IAM role attached to the Elasticsearch domain has the required permissions to write logs to CloudWatch Logs. The role should include
logs:CreateLogStream
and logs:PutLogEvents
permissions.Verify CloudWatch Logs integration: Check if the CloudWatch Logs log group is properly integrated with the Elasticsearch domain. You can do this by navigating to the CloudWatch Logs console and verifying that log streams are being created for the domain.
Review Elasticsearch domain policies: Verify the resource-based policies (Access Policies) attached to the Elasticsearch domain to ensure that the necessary permissions for sending logs to CloudWatch Logs are included.
Remediation Steps
To enable error logging for an Elasticsearch domain to CloudWatch Logs, follow these steps:
Create a Log Group in CloudWatch Logs:
aws logs create-log-group --log-group-name MyElasticsearchLogs
Update Elasticsearch Domain Configuration: Update the Elasticsearch domain configuration to specify the log group created in the previous step as the destination for error logs.
aws es update-elasticsearch-domain-config --domain-name MyElasticsearchDomain --log-publishing-options '{"INDEX_SLOW_LOGS": {"CloudWatchLogsLogGroupArn": "arn:aws:logs:us-east-1:123456789012:log-group:MyElasticsearchLogs:*"}}'
Verify Configuration: Watch for any error messages during the configuration update and check if logs are being successfully sent to the CloudWatch Logs log group.
By following the above steps, you can ensure that error logging for your Elasticsearch domain is correctly configured to send logs to CloudWatch Logs and adhere to AWS Foundational Security Best Practices.