More Info:
Ensure Opensearch logs are sent to cloudwatchRisk Level
MediumAddress
Operational Maturity, Reliability, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- HIPAA
- HITRUST CSF
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- PCI
- Reserve Bank of India (RBI) Cyber Security Framework
- Reserve Bank of India (RBI) Master Direction – Information Technology Framework
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration of OpenSearch not exporting logs to CloudWatch in AWS, you can follow these steps using the AWS Management Console:
- Sign in to the AWS Management Console: Go to the AWS Management Console and sign in with your credentials.
- Navigate to the OpenSearch Service: From the services dropdown, select “OpenSearch Service” under the Analytics section.
- Select the OpenSearch Domain: Choose the OpenSearch domain that you want to configure to export logs to CloudWatch.
- Navigate to the CloudWatch Logs section: In the left-hand navigation pane, click on the “Logs” section under the “Data” category.
- Enable CloudWatch Logs: Click on the “Enable” button to enable the export of OpenSearch logs to CloudWatch.
- Configure Log Settings: In the CloudWatch Logs configuration window, you can specify the log group name, log stream name, and the IAM role that has permission to write logs to CloudWatch.
- Review and Confirm: Review the settings you have configured and click on the “Confirm” button to apply the changes.
- Verify Configuration: After the configuration is applied, you can verify that the OpenSearch logs are now being exported to CloudWatch by checking the CloudWatch Logs console.
Using CLI
Using CLI
To remediate the misconfiguration where OpenSearch should export logs to CloudWatch in AWS, you can follow these steps using the AWS CLI:
-
Enable the Log Publishing Option:
Run the following AWS CLI command to enable the log publishing option for your OpenSearch domain. Replace
<domain-name>with the name of your OpenSearch domain. -
Verify the Configuration:
You can verify that the log publishing option is enabled for your OpenSearch domain by describing the domain configuration using the following command:
- Check CloudWatch Logs: Once the configuration is updated, you should start seeing the OpenSearch logs in CloudWatch Logs. You can access these logs from the AWS Management Console or by using the CloudWatch Logs API.
Using Python
Using Python
To remediate the misconfiguration of OpenSearch not exporting logs to CloudWatch in AWS using Python, you can follow these steps:
-
Install Boto3: Boto3 is the AWS SDK for Python and will allow you to interact with AWS services from your Python script. You can install it using pip:
-
Update OpenSearch Domain Policy: Update the OpenSearch domain policy to allow the OpenSearch domain to publish logs to CloudWatch Logs. You can use the following Python script to update the domain policy:
- Replace placeholders: Replace the placeholder values in the script with your actual OpenSearch domain name, CloudWatch Logs Log Group ARN, and CloudWatch Logs Role ARN.
-
Run the script: Save the script in a Python file (e.g.,
remediate_opensearch_logs.py) and run it using the Python interpreter: - Verify the configuration: After running the script, verify that the OpenSearch domain is now exporting logs to CloudWatch Logs by checking the CloudWatch Logs console for log streams related to your OpenSearch domain.
Using Terraform
Using Terraform
aws_opensearch_domain in place (no forced replacement), but it will trigger a domain update that can take several minutes to complete. If the apply later fails with a permissions error for writing to CloudWatch Logs, you must additionally grant OpenSearch Service permissions to write to these log groups via a CloudWatch Logs resource policy.To verify, terraform plan should show:+creation ofaws_cloudwatch_log_group.application_logs+creation ofaws_cloudwatch_log_group.search_slow_logs~an in-place update toaws_opensearch_domain.thisadding the twolog_publishing_optionsblocks.

