Skip to content
v2.276.0

LogRetentionProps Struct ​

Construction properties for a LogRetention.

Example ​

ts
// 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 ​

logGroupNamestringlog_group_namestrlogGroupNameStringLogGroupNamestringLogGroupName*stringrequired#
The log group name.
logGroupRegionoptionalstringlog_group_regionoptionalstrlogGroupRegionoptionalStringLogGroupRegionoptionalstringLogGroupRegionoptional*string#
The region where the log group should be created.

Default: same region as the stack

logRetentionRetryOptionsoptionalLogRetentionRetryOptionslog_retention_retry_optionsoptionalLogRetentionRetryOptionslogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptions#
Retry options for all AWS API calls.

Default: AWS SDK default retry options

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.RETAIN#
The removalPolicy for the log group when the stack is deleted.
retentionRetentionDaysretentionRetentionDaysretentionRetentionDaysRetentionRetentionDaysRetentionRetentionDaysrequired#
The number of days log events are kept in CloudWatch Logs.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
The IAM role for the Lambda function associated with the custom resource.

Default: A new role is created