RetentionDays

class aws_cdk.aws_logs.RetentionDays(value)

Bases: Enum

How long, in days, the log contents will be retained.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_logs as logs
# my_logs_publishing_role: iam.Role
# vpc: ec2.Vpc


# Exporting logs from a cluster
cluster = rds.DatabaseCluster(self, "Database",
    engine=rds.DatabaseClusterEngine.aurora(
        version=rds.AuroraEngineVersion.VER_1_17_9
    ),
    instance_props=rds.InstanceProps(
        vpc=vpc
    ),
    cloudwatch_logs_exports=["error", "general", "slowquery", "audit"],  # Export all available MySQL-based logs
    cloudwatch_logs_retention=logs.RetentionDays.THREE_MONTHS,  # Optional - default is to never expire logs
    cloudwatch_logs_retention_role=my_logs_publishing_role
)

# Exporting logs from an instance
instance = rds.DatabaseInstance(self, "Instance",
    engine=rds.DatabaseInstanceEngine.postgres(
        version=rds.PostgresEngineVersion.VER_12_3
    ),
    vpc=vpc,
    cloudwatch_logs_exports=["postgresql"]
)

Attributes

EIGHTEEN_MONTHS

18 months.

EIGHT_YEARS

8 years.

FIVE_DAYS

5 days.

FIVE_MONTHS

5 months.

FIVE_YEARS

5 years.

FOUR_MONTHS

4 months.

INFINITE

Retain logs forever.

NINE_YEARS

9 years.

ONE_DAY

1 day.

ONE_MONTH

1 month.

ONE_WEEK

1 week.

ONE_YEAR

1 year.

SEVEN_YEARS

7 years.

SIX_MONTHS

6 months.

SIX_YEARS

6 years.

TEN_YEARS

10 years.

THIRTEEN_MONTHS

13 months.

THREE_DAYS

3 days.

THREE_MONTHS

3 months.

TWO_MONTHS

2 months.

TWO_WEEKS

2 weeks.

TWO_YEARS

2 years.