Skip to main content

More Info:

The log files generated by your AWS CloudTrail trails should be delivered without any failures to designated recipients in order to keep CloudTrail logging data for security and compliance audits.

Risk Level

Low

Address

Operational Maturity, Reliability, Security

Compliance 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
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Log files should be delivered without any failures” for AWS using AWS console, follow the below steps:
  1. Open the AWS Management Console and navigate to the CloudWatch service.
  2. Click on “Logs” in the left-hand menu and select the log group that is experiencing the delivery failure.
  3. Click on the “Actions” drop-down menu and select “Stream to Amazon Elasticsearch Service”.
  4. In the “Stream to Amazon Elasticsearch Service” dialog box, select the Elasticsearch domain that you want to stream the log data to.
  5. Choose the appropriate IAM role that has permission to stream the log data to the Elasticsearch domain.
  6. Configure the log stream settings as required and click on “Start Streaming”.
  7. Once the log stream is successfully started, CloudWatch will begin delivering log data to the Elasticsearch domain without any failures.
  8. You can monitor the log stream status and troubleshoot any issues using the CloudWatch Logs console.
By following these steps, you can remediate the misconfiguration “Log files should be delivered without any failures” for AWS using AWS console.

To remediate the misconfiguration “Log files Should Be Delivered Without Any Failures” in AWS, you can follow the below steps using AWS CLI:
  1. Open the AWS CLI on your local machine or terminal.
  2. Run the following command to create a new S3 bucket to store the logs:
    Replace <bucket-name> with your desired bucket name and <region> with the region in which you want to create the bucket.
  3. Run the following command to enable access logging for your S3 bucket:
    Replace <bucket-name> with the name of the bucket you created in step 2.
  4. Run the following command to create a new CloudWatch Logs group:
    Replace <log-group-name> with your desired name for the log group.
  5. Run the following command to create a new CloudWatch Logs stream:
    Replace <log-group-name> with the name of the log group you created in step 4 and <log-stream-name> with your desired name for the log stream.
  6. Run the following command to create a new CloudWatch Logs subscription filter:
    Replace <log-group-name> with the name of the log group you created in step 4, <filter-name> with your desired name for the filter, and <bucket-name> with the name of the S3 bucket you created in step 2.
  7. Verify that the logs are being delivered to the S3 bucket by checking the contents of the bucket. You should see log files being created and updated in real-time.
By following these steps, you can remediate the misconfiguration “Log files Should Be Delivered Without Any Failures” in AWS using AWS CLI.
To remediate the misconfiguration “Log files Should Be Delivered Without Any Failures” for AWS using Python, you can follow these steps:Step 1: Create an S3 bucket to store the log files.
Step 2: Create an IAM role with permissions to write to the S3 bucket.
Step 3: Create a CloudWatch Logs subscription filter to deliver the log files to the S3 bucket.
Note: Replace the placeholders (your-bucket-name, your-role-name, your-policy-name, your-log-group-name, your-filter-name, and your-account-id) with your own values.These steps will remediate the misconfiguration “Log files Should Be Delivered Without Any Failures” for AWS using Python.
None of these changes force replacement of the S3 bucket, KMS key, CloudTrail trail, or CloudWatch Logs log group; they update policies in place, though the aws_cloudwatch_log_resource_policy will overwrite any existing CloudWatch Logs resource policy with the same policy_name.After applying, terraform plan should show:
  • creation or in-place update of aws_s3_bucket_policy.cloudtrail_logs with the two CloudTrail statements,
  • the KMS key (or only its policy change if it already exists) containing the CloudTrail statement,
  • creation or update of aws_cloudwatch_log_resource_policy.cloudtrail_delivery with the two CloudTrail statements, and no planned resource replacements.

Additional Reading: