LogRetention — AWS Cloud Development Kit 1.204.0 documentation (original) (raw)

AWS Cloud Development Kit

class aws_cdk.aws_lambda.LogRetention(scope, id, *, log_group_name, retention, log_group_region=None, log_retention_retry_options=None, role=None)

Bases: LogRetention

(deprecated) Creates a custom resource to control the retention policy of a CloudWatch Logs log group.

The log group is created if it doesn’t already exist. The policy is removed when retentionDays is undefined or equal to Infinity.

Deprecated:

use LogRetention from ‘

Stability:

deprecated

Aws-cdk:

/aws-logs’ instead

ExampleMetadata:

fixture=_generated

Example:

The code below shows an example of how to instantiate this type.

The values are placeholders you should change.

import aws_cdk.aws_iam as iam import aws_cdk.aws_lambda as lambda_ import aws_cdk.aws_logs as logs import aws_cdk.core as cdk

role: iam.Role

log_retention = lambda_.LogRetention(self, "MyLogRetention", log_group_name="logGroupName", retention=logs.RetentionDays.ONE_DAY,

# the properties below are optional
log_group_region="logGroupRegion",
log_retention_retry_options=logs.LogRetentionRetryOptions(
    base=cdk.Duration.minutes(30),
    max_retries=123
),
role=role

)

Parameters:

Stability:

deprecated

Methods

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

log_group_arn

The ARN of the LogGroup.

node

The construct tree node associated with this construct.

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any)

Return type:

bool