Skip to main content

More Info:

AWS CloudTrail events should be monitored with CloudWatch Logs for management and security purposes.

Risk Level

Low

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Well Architected Framework
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AWS
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • FedRAMP
  • GDPR
  • HIPAA
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST
  • 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
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “CloudTrail Events Should Be Monitored By CloudWatch Logs” in AWS using the AWS console, follow these steps:
  1. Open the AWS Management Console and navigate to the CloudTrail service.
  2. Select the trail for which you want to enable CloudWatch Logs monitoring.
  3. Click on the “Edit” button in the “CloudWatch Logs” section.
  4. Select the option “Yes” for “Enable CloudWatch Logs”.
  5. Choose a CloudWatch Logs log group to which you want to send the CloudTrail events.
  6. Click on the “Save” button to save the changes.
  7. Verify that the CloudWatch Logs integration is working by checking the log group for the CloudTrail events.
By following these steps, you will have successfully remediated the misconfiguration “CloudTrail Events Should Be Monitored By CloudWatch Logs” in AWS.

To remediate the misconfiguration “CloudTrail Events Should Be Monitored By CloudWatch Logs” for AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to create a new CloudWatch Logs group:
    Replace my-log-group-name with the name you want to give to your CloudWatch Logs group.
  3. Run the following command to create a new CloudWatch Logs stream:
    Replace my-log-group-name with the name of the CloudWatch Logs group you created in step 2, and replace my-log-stream-name with the name you want to give to your CloudWatch Logs stream.
  4. Run the following command to enable CloudTrail log file validation:
    Replace my-trail-name with the name of the CloudTrail trail you want to enable log file validation for.
  5. Run the following command to configure CloudTrail to send events to your CloudWatch Logs group:
    Replace my-trail-name with the name of the CloudTrail trail you want to configure, replace arn:aws:logs:us-east-1:123456789012:log-group:my-log-group-name with the ARN of the CloudWatch Logs group you created in step 2, and replace arn:aws:iam::123456789012:role/my-cloudtrail-role with the ARN of the IAM role you want to use for CloudTrail. Note: You need to have the required permissions to create CloudWatch Logs group, stream and IAM role.
  6. Verify that CloudTrail events are being sent to your CloudWatch Logs group by checking the logs in the CloudWatch Logs console. Congratulations! You have successfully remediated the misconfiguration “CloudTrail Events Should Be Monitored By CloudWatch Logs” for AWS using AWS CLI.
To remediate this misconfiguration in AWS, you can use the following steps in Python:
  1. Import the necessary modules:
  1. Create a CloudWatch Logs client:
  1. Get a list of all the existing CloudTrail logs:
  1. For each CloudTrail log, check if it is already being monitored by CloudWatch Logs:
  1. Replace the destinationArn parameter with the ARN of the CloudWatch Logs destination you want to use.
  2. Save the Python script and run it to remediate the misconfiguration.
This script will create a new CloudWatch Logs log group for each CloudTrail log that is not already being monitored, and then create a CloudWatch Logs subscription filter for that log group. This will ensure that all CloudTrail events are monitored by CloudWatch Logs.
Substitute:
  • var.TRAIL_NAME (or "TRAIL_NAME") with the name of the existing CloudTrail trail ({{asset_label}} in your CLI example).
  • TRAIL_S3_BUCKET_NAME with the S3 bucket used by the trail.
  • CLOUDTRAIL_LOGS_ROLE_NAME with your approved IAM role name, if you have naming standards.
This change is in-place for the trail (no forced replacement). It will create a new log group and IAM role/policy.To verify, terraform plan should show:
  • + creation of aws_cloudwatch_log_group.cloudtrail
  • + creation of aws_iam_role.cloudtrail_cloudwatch_logs and aws_iam_role_policy.cloudtrail_cloudwatch_logs
  • ~ update to aws_cloudtrail.this adding cloud_watch_logs_group_arn and cloud_watch_logs_role_arn.

Additional Reading: