Interface ILogGroupProps
Properties for a LogGroup.
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ILogGroupProps
Syntax (vb)
Public Interface ILogGroupProps
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var kmsKey = new Key(this, "KmsKey");
// Pass the KMS key in the `encryptionKey` field to associate the key to the log group
var logGroup = new LogGroup(this, "LogGroup", new LogGroupProps {
EncryptionKey = kmsKey
});
// Pass the KMS key in the `encryptionKey` field to associate the key to the S3 bucket
var execBucket = new Bucket(this, "EcsExecBucket", new BucketProps {
EncryptionKey = kmsKey
});
var cluster = new Cluster(this, "Cluster", new ClusterProps {
Vpc = vpc,
ExecuteCommandConfiguration = new ExecuteCommandConfiguration {
KmsKey = kmsKey,
LogConfiguration = new ExecuteCommandLogConfiguration {
CloudWatchLogGroup = logGroup,
CloudWatchEncryptionEnabled = true,
S3Bucket = execBucket,
S3EncryptionEnabled = true,
S3KeyPrefix = "exec-command-output"
},
Logging = ExecuteCommandLogging.OVERRIDE
}
});
Synopsis
Properties
DataProtectionPolicy | Data Protection Policy for this log group. |
EncryptionKey | The KMS customer managed key to encrypt the log group with. |
LogGroupClass | The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS. |
LogGroupName | Name of the log group. |
RemovalPolicy | Determine the removal policy of this log group. |
Retention | How long, in days, the log contents will be retained. |
Properties
DataProtectionPolicy
Data Protection Policy for this log group.
virtual DataProtectionPolicy DataProtectionPolicy { get; }
Property Value
Remarks
Default: - no data protection policy
EncryptionKey
The KMS customer managed key to encrypt the log group with.
virtual IKey EncryptionKey { get; }
Property Value
Remarks
Default: Server-side encrpytion managed by the CloudWatch Logs service
LogGroupClass
The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.
virtual Nullable<LogGroupClass> LogGroupClass { get; }
Property Value
System.Nullable<LogGroupClass>
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.
virtual string LogGroupName { get; }
Property Value
System.String
Remarks
Default: Automatically generated
RemovalPolicy
Determine the removal policy of this log group.
virtual Nullable<RemovalPolicy> RemovalPolicy { get; }
Property Value
System.Nullable<RemovalPolicy>
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.
virtual Nullable<RetentionDays> Retention { get; }
Property Value
System.Nullable<RetentionDays>
Remarks
To retain all logs, set this value to RetentionDays.INFINITE.
Default: RetentionDays.TWO_YEARS