Skip to main content

Based on EventBridge rule, automatically set the logGroup retention policy when new AWS CloudWatch logGroup is created.

Project description

Cloudwatch Retention Setter

releasenpm versionPyPI version

Cloudwatch Retention Setter is an AWS CDK construct library that reacts on AWS CloudWatch events. AWS CloudWatch does not offer the ability to set a "default retention policy" that would be set to all newly created Log Groups (e.g. by Lambda Function runs).

This construct addresses this by monitoring AWS CloudWatch Events via EventBridge, when a new LogGroup is created a Lambda function is invoked automatically that sets the retention policy to the specified value.

Getting started

TypeScript

Installation

npm:

npm install --save cloudwatch-retention-setter

yarn:

yarn add cloudwatch-retention-setter

Usage

import * as cdk from 'aws-cdk-lib';
import { CloudwatchRetentionSetter } from 'cloudwatch-retention-setter';
import { RetentionDays } from 'aws-cdk-lib/aws-logs';
import { Schedule } from 'aws-cdk-lib/aws-events';

const app = new cdk.App();
const stack = new cdk.Stack(app, '<stack-name>');

// use default retention of 6 months
new CloudwatchRetentionSetter(stack, 'cloudwatch-retention-setter');

// use custom retention
new CloudwatchRetentionSetter(stack, 'cloudwatch-retention-setter', {
  retentionDays: RetentionDays.ONE_MONTH,
});

Python

Installation

$ pip install cloudwatch-retention-setter

Usage

import aws_cdk.core as cdk
from cdk_cloudwatch_retention_setter import CloudwatchRetentionSetter

app = cdk.App()
stack = cdk.Stack(app, "<stack-name>")

CloudwatchRetentionSetter(stack, "cloudwatch-retention-setter")

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file rantoniuk.cloudwatch-retention-setter-0.0.15.tar.gz.

File metadata

File hashes

Hashes for rantoniuk.cloudwatch-retention-setter-0.0.15.tar.gz
Algorithm Hash digest
SHA256 bf93dde3970364c71c4c0db5d4598f94dc505ce0d7de4684255a7903804056de
MD5 04428fe8e8fa611d945207b39d18a8ea
BLAKE2b-256 512c7dbad499632c50db0fe9721d07a252c9f582e06c4bb3b0e40deed5088c77

See more details on using hashes here.

File details

Details for the file rantoniuk.cloudwatch_retention_setter-0.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for rantoniuk.cloudwatch_retention_setter-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 3f521fae8e9aeb9b773e54a8a097bb25a14afe7b79ed353ddabe172df62a51ef
MD5 98751fc1645e556f1a2cb59661eda697
BLAKE2b-256 acb0fe75b61cabbb0ea60763cda06906b03f6c6842298be8eeee591a2dea754b

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