Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.35 KB

File metadata and controls

37 lines (25 loc) · 1.35 KB

cloudwatch-logs-auto-set-retention

Version License

Updates the retention policy for new and existing CloudWatch log groups to the specified number of days.

Deploying to your account (via the console)

Go to this page and click the Deploy button.

Deploying via SAM/Serverless framework/CloudFormation

To deploy this via SAM, you need something like this in the CloudFormation template:

AutoSetLogRetention:
  Type: AWS::Serverless::Application
  Properties:
    Location:
      ApplicationId: arn:aws:serverlessrepo:us-east-1:374852340823:applications/auto-set-log-group-retention
      SemanticVersion: <enter latest version>
    Parameters:
      RetentionDays: <defaults to 7>

To do the same via CloudFormation or the Serverless framework, you need to first add the following Transform:

Transform: AWS::Serverless-2016-10-31

For more details, read this post.

Parameters

RetentionDays: The number of days to retain logs in CloudWatch Logs for.