enum RetentionDays
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Logs.RetentionDays |
Java | software.amazon.awscdk.services.logs.RetentionDays |
Python | aws_cdk.aws_logs.RetentionDays |
TypeScript (source) | @aws-cdk/aws-logs » RetentionDays |
How long, in days, the log contents will be retained.
Example
import * as logs from '@aws-cdk/aws-logs';
declare const myLogsPublishingRole: iam.Role;
declare const vpc: ec2.Vpc;
// Exporting logs from a cluster
const cluster = new rds.DatabaseCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.aurora({
version: rds.AuroraEngineVersion.VER_1_17_9, // different version class for each engine type
}),
instanceProps: {
vpc,
},
cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], // Export all available MySQL-based logs
cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs
cloudwatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided
// ...
});
// Exporting logs from an instance
const instance = new rds.DatabaseInstance(this, 'Instance', {
engine: rds.DatabaseInstanceEngine.postgres({
version: rds.PostgresEngineVersion.VER_12_3,
}),
vpc,
cloudwatchLogsExports: ['postgresql'], // Export the PostgreSQL logs
// ...
});
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. |
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.
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.