Show / Hide Table of Contents

Interface ILogGroupProps

Properties for a LogGroup.

Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.AWS.Logs.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

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.

Properties

EncryptionKey

The KMS Key to encrypt the log group with.

virtual IKey EncryptionKey { get; }
Property Value

IKey

Remarks

Default: - log group is encrypted with the default master key

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

Back to top Generated by DocFX