class LogRetention (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.LogRetention |
Java | software.amazon.awscdk.services.lambda.LogRetention |
Python | aws_cdk.aws_lambda.LogRetention |
TypeScript (source) | @aws-cdk/aws-lambda » LogRetention |
⚠️ Deprecated: use LogRetention
from '
Implements
IConstruct
, IConstruct
, IDependable
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
.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import * as logs from '@aws-cdk/aws-logs';
import * as cdk from '@aws-cdk/core';
declare const role: iam.Role;
const logRetention = new lambda.LogRetention(this, 'MyLogRetention', {
logGroupName: 'logGroupName',
retention: logs.RetentionDays.ONE_DAY,
// the properties below are optional
logGroupRegion: 'logGroupRegion',
logRetentionRetryOptions: {
base: cdk.Duration.minutes(30),
maxRetries: 123,
},
role: role,
});
Initializer
new LogRetention(scope: Construct, id: string, props: LogRetentionProps)
⚠️ Deprecated: use LogRetention
from '
Parameters
- scope
Construct
- id
string
- props
Log
Retention Props
Construct Props
Name | Type | Description |
---|---|---|
log | string | The log group name. |
retention | Retention | The number of days log events are kept in CloudWatch Logs. |
log | string | The region where the log group should be created. |
log | Log | Retry options for all AWS API calls. |
role? | IRole | The IAM role for the Lambda function associated with the custom resource. |
logGroupName
⚠️ Deprecated: use LogRetentionProps
from '
Type:
string
The log group name.
retention
⚠️ Deprecated: use LogRetentionProps
from '
Type:
Retention
The number of days log events are kept in CloudWatch Logs.
logGroupRegion?
⚠️ Deprecated: use LogRetentionProps
from '
Type:
string
(optional, default: same region as the stack)
The region where the log group should be created.
logRetentionRetryOptions?
⚠️ Deprecated: use LogRetentionProps
from '
Type:
Log
(optional, default: AWS SDK default retry options)
Retry options for all AWS API calls.
role?
⚠️ Deprecated: use LogRetentionProps
from '
Type:
IRole
(optional, default: A new role is created)
The IAM role for the Lambda function associated with the custom resource.
Properties
Name | Type | Description |
---|---|---|
log | string | The ARN of the LogGroup. |
node | Construct | The construct tree node associated with this construct. |
logGroupArn
⚠️ Deprecated: use LogRetention
from '
Type:
string
The ARN of the LogGroup.
node
⚠️ Deprecated: use LogRetention
from '
Type:
Construct
The construct tree node associated with this construct.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
String()
topublic toString(): string
⚠️ Deprecated: use LogRetention
from '
Returns
string
Returns a string representation of this construct.