aws-cdk-lib.aws_logs.LogRetentionProps

interface LogRetentionProps

LanguageType name
.NETAmazon.CDK.AWS.Logs.LogRetentionProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslogs#LogRetentionProps
Javasoftware.amazon.awscdk.services.logs.LogRetentionProps
Pythonaws_cdk.aws_logs.LogRetentionProps
TypeScript (source)aws-cdk-lib » aws_logs » LogRetentionProps

Construction properties for a LogRetention.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';

declare const role: iam.Role;
const logRetentionProps: logs.LogRetentionProps = {
  logGroupName: 'logGroupName',
  retention: logs.RetentionDays.ONE_DAY,

  // the properties below are optional
  logGroupRegion: 'logGroupRegion',
  logRetentionRetryOptions: {
    base: cdk.Duration.minutes(30),
    maxRetries: 123,
  },
  removalPolicy: cdk.RemovalPolicy.DESTROY,
  role: role,
};

Properties

NameTypeDescription
logGroupNamestringThe log group name.
retentionRetentionDaysThe number of days log events are kept in CloudWatch Logs.
logGroupRegion?stringThe region where the log group should be created.
logRetentionRetryOptions?LogRetentionRetryOptionsRetry options for all AWS API calls.
removalPolicy?RemovalPolicyThe removalPolicy for the log group when the stack is deleted.
role?IRoleThe IAM role for the Lambda function associated with the custom resource.

logGroupName

Type: string

The log group name.


retention

Type: RetentionDays

The number of days log events are kept in CloudWatch Logs.


logGroupRegion?

Type: string (optional, default: same region as the stack)

The region where the log group should be created.


logRetentionRetryOptions?

Type: LogRetentionRetryOptions (optional, default: AWS SDK default retry options)

Retry options for all AWS API calls.


removalPolicy?

Type: RemovalPolicy (optional, default: RemovalPolicy.RETAIN)

The removalPolicy for the log group when the stack is deleted.


role?

Type: IRole (optional, default: A new role is created)

The IAM role for the Lambda function associated with the custom resource.