LogRetentionProps

class aws_cdk.aws_logs.LogRetentionProps(*, log_group_name, retention, log_group_region=None, log_retention_retry_options=None, removal_policy=None, role=None)

Bases: object

Construction properties for a LogRetention.

Parameters:
  • log_group_name (str) – The log group name.

  • retention (RetentionDays) – The number of days log events are kept in CloudWatch Logs.

  • log_group_region (Optional[str]) – The region where the log group should be created. Default: - same region as the stack

  • log_retention_retry_options (Union[LogRetentionRetryOptions, Dict[str, Any], None]) – Retry options for all AWS API calls. Default: - AWS SDK default retry options

  • removal_policy (Optional[RemovalPolicy]) – The removalPolicy for the log group when the stack is deleted. Default: RemovalPolicy.RETAIN

  • role (Optional[IRole]) – The IAM role for the Lambda function associated with the custom resource. Default: - A new role is created

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 as cdk
from aws_cdk import aws_iam as iam
from aws_cdk import aws_logs as logs

# role: iam.Role

log_retention_props = logs.LogRetentionProps(
    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
    ),
    removal_policy=cdk.RemovalPolicy.DESTROY,
    role=role
)

Attributes

log_group_name

The log group name.

log_group_region

The region where the log group should be created.

Default:
  • same region as the stack

log_retention_retry_options

Retry options for all AWS API calls.

Default:
  • AWS SDK default retry options

removal_policy

The removalPolicy for the log group when the stack is deleted.

Default:

RemovalPolicy.RETAIN

retention

The number of days log events are kept in CloudWatch Logs.

role

The IAM role for the Lambda function associated with the custom resource.

Default:
  • A new role is created