log-group-retention

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2019 License: MIT

README

AWS log group retention Build Status codecov

CloudWatch logs can be expensive if no retention is set for the log groups. This lambda function will fire up every 60 minutes and iterate over all log groups in the AWS account and if RetentionPolicy is not present it will create policy with 60 days retention*.

  • this value can be changed. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653.


                         ------------------------------------------------
   CloudWatch Event     |   log-group-retention                          |
   (every 60 minutes)   |   1. Get all log groups                        |
----------------------> |   2. If retention policy is missing            |
                        |   3. Put retention policy                      |
                         ------------------------------------------------

Runbuild.sh, upload.sh and deploy.sh accordingly to get app up and running.

CodePipeline

Deploy first cloudformation-service-role

Deploy codepipeline(replace GITHUB_TOKEN and ACCOUNT_ID):

aws cloudformation deploy \
    --stack-name log-group-retention-codepipeline \
    --parameter-overrides GitHubUser="flow-lab" GitHubRepository="log-group-retention" GitHubOAuthToken="GITHUB_TOKEN" \
    --role-arn "arn:aws:iam::ACCOUNT_ID:role/cloudformation-service-role" \
    --template cloudformation/pipeline.yml \
    --capabilities CAPABILITY_NAMED_IAM \
    --profile cloudformation@flowlab-development

License

MIT License (MIT)

Directories

Path Synopsis
lambdas

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL