Ensure log retention policy is set for AWS CloudWatch Log Group

MEDIUM

Description

CloudWatch logs are all kept without deletion by default, however this can become costly over time so many administrators will configure a retention period. It is important to ensure that this is configured with a specific timeframe in accordance with regulatory requirements. This can also be used in conjunction with the archive setting to rotate logs. For more information, see the AWS documentation.
References:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html

Remediation

In AWS Console -

  1. Sign in to AWS Console and go to the CloudWatch console.
  2. Select Log Groups in the navigation pane.
  3. Select the log group to update.
  4. Select 'Edit retention' and change the log retention value to 120 days.

In Terraform -

  1. In the aws_cloudwatch_log_group resource, set the field retention_in_days to 120 days.

References:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group#retention_in_days

Policy Details

Rule Reference ID: AC_AWS_0452
CSP: AWS
Remediation Available: Yes
Resource Category: Logging and Monitoring
Resource Type: CloudWatch

Frameworks