interface LogGroupProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Logs.LogGroupProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#LogGroupProps |
![]() | software.amazon.awscdk.services.logs.LogGroupProps |
![]() | aws_cdk.aws_logs.LogGroupProps |
![]() | aws-cdk-lib » aws_logs » LogGroupProps |
Properties for a LogGroup.
Example
import * as kinesisfirehose from '@aws-cdk/aws-kinesisfirehose-alpha';
import * as destinations from '@aws-cdk/aws-kinesisfirehose-destinations-alpha';
const logGroupDestination = new logs.LogGroup(this, 'LogGroupLambdaAudit', {
logGroupName: 'auditDestinationForCDK',
});
const bucket = new s3.Bucket(this, 'audit-bucket');
const s3Destination = new destinations.S3Bucket(bucket);
const deliveryStream = new kinesisfirehose.DeliveryStream(this, 'Delivery Stream', {
destination: s3Destination,
});
const dataProtectionPolicy = new logs.DataProtectionPolicy({
name: 'data protection policy',
description: 'policy description',
identifiers: [
logs.DataIdentifier.DRIVERSLICENSE_US, // managed data identifier
new logs.DataIdentifier('EmailAddress'), // forward compatibility for new managed data identifiers
new logs.CustomDataIdentifier('EmployeeId', 'EmployeeId-\\d{9}')], // custom data identifier
logGroupAuditDestination: logGroupDestination,
s3BucketAuditDestination: bucket,
deliveryStreamNameAuditDestination: deliveryStream.deliveryStreamName,
});
new logs.LogGroup(this, 'LogGroupLambda', {
logGroupName: 'cdkIntegLogGroup',
dataProtectionPolicy: dataProtectionPolicy,
});
Properties
Name | Type | Description |
---|---|---|
data | Data | Data Protection Policy for this log group. |
encryption | IKey | The KMS customer managed key to encrypt the log group with. |
field | Field [] | Field Index Policies for this log group. |
log | Log | The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS. |
log | string | Name of the log group. |
removal | Removal | Determine the removal policy of this log group. |
retention? | Retention | How long, in days, the log contents will be retained. |
dataProtectionPolicy?
Type:
Data
(optional, default: no data protection policy)
Data Protection Policy for this log group.
encryptionKey?
Type:
IKey
(optional, default: Server-side encryption managed by the CloudWatch Logs service)
The KMS customer managed key to encrypt the log group with.
fieldIndexPolicies?
Type:
Field
[]
(optional, default: no field index policies for this log group.)
Field Index Policies for this log group.
logGroupClass?
Type:
Log
(optional, default: LogGroupClass.STANDARD)
The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.
INFREQUENT_ACCESS class provides customers a cost-effective way to consolidate logs which supports querying using Logs Insights. The logGroupClass property cannot be changed once the log group is created.
logGroupName?
Type:
string
(optional, default: Automatically generated)
Name of the log group.
removalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.Retain)
Determine the removal policy of this log group.
Normally you want to retain the log group so you can diagnose issues from logs even after a deployment that no longer includes the log group. In that case, use the normal date-based retention policy to age out your logs.
retention?
Type:
Retention
(optional, default: RetentionDays.TWO_YEARS)
How long, in days, the log contents will be retained.
To retain all logs, set this value to RetentionDays.INFINITE.