Class LogGroupProps
Properties for a LogGroup.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.AWS.Logs.dll
Syntax (csharp)
public class LogGroupProps : Object, ILogGroupProps
Syntax (vb)
Public Class LogGroupProps
Inherits Object
Implements 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
Constructors
LogGroupProps() |
Properties
EncryptionKey | The KMS Key to encrypt the log group with. |
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. |
Constructors
LogGroupProps()
public LogGroupProps()
Properties
EncryptionKey
The KMS Key to encrypt the log group with.
public IKey EncryptionKey { get; set; }
Property Value
Remarks
Default: - log group is encrypted with the default master key
LogGroupName
Name of the log group.
public string LogGroupName { get; set; }
Property Value
System.String
Remarks
Default: Automatically generated
RemovalPolicy
Determine the removal policy of this log group.
public Nullable<RemovalPolicy> RemovalPolicy { get; set; }
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.
public Nullable<RetentionDays> Retention { get; set; }
Property Value
System.Nullable<RetentionDays>
Remarks
To retain all logs, set this value to RetentionDays.INFINITE.
Default: RetentionDays.TWO_YEARS