LogRetentionProps Struct
Construction properties for a LogRetention.
| Source | aws-logs/lib/log-retention.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
declare const role: iam.Role;
const logRetentionProps: logs.LogRetentionProps = {
logGroupName: 'logGroupName',
retention: logs.RetentionDays.ONE_DAY,
// the properties below are optional
logGroupRegion: 'logGroupRegion',
logRetentionRetryOptions: {
base: cdk.Duration.minutes(30),
maxRetries: 123,
},
removalPolicy: cdk.RemovalPolicy.DESTROY,
role: role,
};
python
# 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
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.logs.*;
Role role;
LogRetentionProps logRetentionProps = LogRetentionProps.builder()
.logGroupName("logGroupName")
.retention(RetentionDays.ONE_DAY)
// the properties below are optional
.logGroupRegion("logGroupRegion")
.logRetentionRetryOptions(LogRetentionRetryOptions.builder()
.base(Duration.minutes(30))
.maxRetries(123)
.build())
.removalPolicy(RemovalPolicy.DESTROY)
.role(role)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.Logs;
Role role;
var logRetentionProps = new LogRetentionProps {
LogGroupName = "logGroupName",
Retention = RetentionDays.ONE_DAY,
// the properties below are optional
LogGroupRegion = "logGroupRegion",
LogRetentionRetryOptions = new LogRetentionRetryOptions {
Base = Duration.Minutes(30),
MaxRetries = 123
},
RemovalPolicy = RemovalPolicy.DESTROY,
Role = role
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var role Role
logRetentionProps := &LogRetentionProps{
LogGroupName: jsii.String("logGroupName"),
Retention: awscdk.Aws_logs.RetentionDays_ONE_DAY,
// the properties below are optional
LogGroupRegion: jsii.String("logGroupRegion"),
LogRetentionRetryOptions: &LogRetentionRetryOptions{
Base: cdk.Duration_Minutes(jsii.Number(30)),
MaxRetries: jsii.Number(123),
},
RemovalPolicy: cdk.RemovalPolicy_DESTROY,
Role: role,
}
Properties
logGroupNamestringlog_group_namestrlogGroupNameStringLogGroupNamestringLogGroupName*string required #The log group name.
logGroupRegionoptionalstringlog_group_regionoptionalstrlogGroupRegionoptionalStringLogGroupRegionoptionalstringLogGroupRegionoptional*string #The region where the log group should be created.
Default: same region as the stack
logRetentionRetryOptionsoptionalLogRetentionRetryOptionslog_retention_retry_optionsoptionalLogRetentionRetryOptionslogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptions #Retry options for all AWS API calls.
Default: AWS SDK default retry options
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy = RemovalPolicy.RETAIN #The removalPolicy for the log group when the stack is deleted.
retentionRetentionDaysretentionRetentionDaysretentionRetentionDaysRetentionRetentionDaysRetentionRetentionDays required #The number of days log events are kept in CloudWatch Logs.