enum RetentionDays
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Logs.RetentionDays |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#RetentionDays |
Java | software.amazon.awscdk.services.logs.RetentionDays |
Python | aws_cdk.aws_logs.RetentionDays |
TypeScript (source) | aws-cdk-lib » aws_logs » RetentionDays |
How long, in days, the log contents will be retained.
Example
import * as iam from 'aws-cdk-lib/aws-iam';
import * as logs from'aws-cdk-lib/aws-logs';
declare const myLogsPublishingRole: iam.Role;
declare const vpc: ec2.Vpc;
const cluster = new docdb.DatabaseCluster(this, 'Database', {
masterUser: {
username: 'myuser',
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
exportProfilerLogsToCloudWatch: true, // Enable sending profiler logs
exportAuditLogsToCloudWatch: true, // Enable sending audit logs
cloudWatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs
cloudWatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided
});
Members
Name | Description |
---|---|
ONE_DAY | 1 day. |
THREE_DAYS | 3 days. |
FIVE_DAYS | 5 days. |
ONE_WEEK | 1 week. |
TWO_WEEKS | 2 weeks. |
ONE_MONTH | 1 month. |
TWO_MONTHS | 2 months. |
THREE_MONTHS | 3 months. |
FOUR_MONTHS | 4 months. |
FIVE_MONTHS | 5 months. |
SIX_MONTHS | 6 months. |
ONE_YEAR | 1 year. |
THIRTEEN_MONTHS | 13 months. |
EIGHTEEN_MONTHS | 18 months. |
TWO_YEARS | 2 years. |
THREE_YEARS | 3 years. |
FIVE_YEARS | 5 years. |
SIX_YEARS | 6 years. |
SEVEN_YEARS | 7 years. |
EIGHT_YEARS | 8 years. |
NINE_YEARS | 9 years. |
TEN_YEARS | 10 years. |
INFINITE | Retain logs forever. |
ONE_DAY
1 day.
THREE_DAYS
3 days.
FIVE_DAYS
5 days.
ONE_WEEK
1 week.
TWO_WEEKS
2 weeks.
ONE_MONTH
1 month.
TWO_MONTHS
2 months.
THREE_MONTHS
3 months.
FOUR_MONTHS
4 months.
FIVE_MONTHS
5 months.
SIX_MONTHS
6 months.
ONE_YEAR
1 year.
THIRTEEN_MONTHS
13 months.
EIGHTEEN_MONTHS
18 months.
TWO_YEARS
2 years.
THREE_YEARS
3 years.
FIVE_YEARS
5 years.
SIX_YEARS
6 years.
SEVEN_YEARS
7 years.
EIGHT_YEARS
8 years.
NINE_YEARS
9 years.
TEN_YEARS
10 years.
INFINITE
Retain logs forever.