Class LogGroupProps
Properties for a LogGroup.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LogGroupProps : Object, ILogGroupProps
Syntax (vb)
Public Class LogGroupProps
Inherits Object
Implements ILogGroupProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.KinesisFirehose.Alpha;
using Amazon.CDK.AWS.KinesisFirehose.Destinations.Alpha;
var logGroupDestination = new LogGroup(this, "LogGroupLambdaAudit", new LogGroupProps {
LogGroupName = "auditDestinationForCDK"
});
var bucket = new Bucket(this, "audit-bucket");
var s3Destination = new S3Bucket(bucket);
var deliveryStream = new DeliveryStream(this, "Delivery Stream", new DeliveryStreamProps {
Destination = s3Destination
});
var dataProtectionPolicy = new DataProtectionPolicy(new DataProtectionPolicyProps {
Name = "data protection policy",
Description = "policy description",
Identifiers = new [] { DataIdentifier.DRIVERSLICENSE_US, // managed data identifier
new DataIdentifier("EmailAddress"), // forward compatibility for new managed data identifiers
new CustomDataIdentifier("EmployeeId", "EmployeeId-\\d{9}") }, // custom data identifier
LogGroupAuditDestination = logGroupDestination,
S3BucketAuditDestination = bucket,
DeliveryStreamNameAuditDestination = deliveryStream.DeliveryStreamName
});
new LogGroup(this, "LogGroupLambda", new LogGroupProps {
LogGroupName = "cdkIntegLogGroup",
DataProtectionPolicy = dataProtectionPolicy
});
Synopsis
Constructors
Log |
Properties
Data |
Data Protection Policy for this log group. |
Encryption |
The KMS customer managed key to encrypt the log group with. |
Log |
The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS. |
Log |
Name of the log group. |
Removal |
Determine the removal policy of this log group. |
Retention | How long, in days, the log contents will be retained. |
Constructors
LogGroupProps()
public LogGroupProps()
Properties
DataProtectionPolicy
Data Protection Policy for this log group.
public DataProtectionPolicy DataProtectionPolicy { get; set; }
Property Value
Remarks
Default: - no data protection policy
EncryptionKey
The KMS customer managed key to encrypt the log group with.
public IKey EncryptionKey { get; set; }
Property Value
Remarks
Default: Server-side encryption managed by the CloudWatch Logs service
LogGroupClass
The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.
public Nullable<LogGroupClass> LogGroupClass { get; set; }
Property Value
System.
Remarks
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.
Default: LogGroupClass.STANDARD
LogGroupName
Name of the log group.
public string LogGroupName { get; set; }
Property Value
System.
Remarks
Default: Automatically generated
RemovalPolicy
Determine the removal policy of this log group.
public Nullable<RemovalPolicy> RemovalPolicy { get; set; }
Property Value
System.
Remarks
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.
Default: RemovalPolicy.Retain
Retention
How long, in days, the log contents will be retained.
public Nullable<RetentionDays> Retention { get; set; }
Property Value
System.
Remarks
To retain all logs, set this value to RetentionDays.INFINITE.
Default: RetentionDays.TWO_YEARS