Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
functions
.gitignore
LICENSE
README.md
package-lock.json
package.json
template.yml

README.md

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.

You can’t perform that action at this time.