Skip to main content

Maintain AWS CloudWatch log streams

Project description

AWS Cloudwatch Log minder

AWS CloudWatch logs is an useful logging system, but it has two quircks. It does not allow you too set a default retention period for newly created log groups, and it does not delete empty log streams that are older than the retention period. This utility:

  1. sets a default retention period on log groups without a period set.
  2. removes empty log streams older than the retention period of the log group

You can use it as a command line utility. You can also install it as an AWS Lambda function and have your logs kept in order, NoOps style!

install the log minder

to install the log minder, type:

pip install aws-cloudwatch-log-minder

set default retention period

to set the default retention period on log groups without one, type:

cwlogs-minder --dry-run set-log-retention --days 30

This will show you which log groups will have its retention period set. Remove the --dry-run and it the retention period will be set.

delete empty log streams

To delete empty log streams older than the retention period, type:

cwlogs-minder --dry-run delete-empty-log-streams

This will show you which empty log streams will be deleted. Remove the --dry-run and these stream will be deleted.

deploy the log minder

To deploy the log minder as an AWS Lambda, type:

git clone https://github.com/binxio/aws-cloudwatch-log-minder.git
cd aws-cloudwatch-log-minder
aws cloudformation create-stack \
        --capabilities CAPABILITY_IAM \
        --stack-name aws-cloudwatch-log-minder \
        --template-body file://./cloudformation/aws-cloudwatch-log-minder.yaml

aws cloudformation wait stack-create-complete  --stack-name aws-cloudwatch-log-minder

This will install the log minder in your AWS account and run every hour.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cloudwatch-log-minder-0.1.6.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file aws-cloudwatch-log-minder-0.1.6.tar.gz.

File metadata

  • Download URL: aws-cloudwatch-log-minder-0.1.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for aws-cloudwatch-log-minder-0.1.6.tar.gz
Algorithm Hash digest
SHA256 dcc50e49c0ae7aced57123fd67a56ae1b58289e1875d70a742956f60d68809ed
MD5 bcf2623803696efbd9388a6529bf695b
BLAKE2b-256 5cff11d0e0c4236a6d089664a5a183fb084a0faf6ae7d108a40cb163ca3fce2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page