Class LogGroupProps
Properties for a LogGroup.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LogGroupProps : ILogGroupProps
Syntax (vb)
Public Class LogGroupProps Implements ILogGroupProps
Remarks
ExampleMetadata: infused
Examples
Role myRole;
new AwsCustomResource(this, "Customized", new AwsCustomResourceProps {
Role = myRole, // must be assumable by the `lambda.amazonaws.com` service principal
Timeout = Duration.Minutes(10), // defaults to 2 minutes
MemorySize = 1025, // defaults to 512 if installLatestAwsSdk is true
LogGroup = new LogGroup(this, "AwsCustomResourceLogs", new LogGroupProps {
Retention = RetentionDays.ONE_DAY
}),
FunctionName = "my-custom-name", // defaults to a CloudFormation generated name
RemovalPolicy = RemovalPolicy.RETAIN, // defaults to `RemovalPolicy.DESTROY`
Policy = AwsCustomResourcePolicy.FromSdkCalls(new SdkCallsPolicyOptions {
Resources = AwsCustomResourcePolicy.ANY_RESOURCE
})
});
Synopsis
Constructors
| LogGroupProps() | Properties for a LogGroup. |
Properties
| DataProtectionPolicy | Data Protection Policy for this log group. |
| DeletionProtectionEnabled | Indicates whether deletion protection is enabled for this log group. |
| EncryptionKey | The KMS customer managed key to encrypt the log group with. |
| FieldIndexPolicies | Field Index Policies for this log group. |
| 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. |
Constructors
LogGroupProps()
Properties for a LogGroup.
public LogGroupProps()
Remarks
ExampleMetadata: infused
Examples
Role myRole;
new AwsCustomResource(this, "Customized", new AwsCustomResourceProps {
Role = myRole, // must be assumable by the `lambda.amazonaws.com` service principal
Timeout = Duration.Minutes(10), // defaults to 2 minutes
MemorySize = 1025, // defaults to 512 if installLatestAwsSdk is true
LogGroup = new LogGroup(this, "AwsCustomResourceLogs", new LogGroupProps {
Retention = RetentionDays.ONE_DAY
}),
FunctionName = "my-custom-name", // defaults to a CloudFormation generated name
RemovalPolicy = RemovalPolicy.RETAIN, // defaults to `RemovalPolicy.DESTROY`
Policy = AwsCustomResourcePolicy.FromSdkCalls(new SdkCallsPolicyOptions {
Resources = AwsCustomResourcePolicy.ANY_RESOURCE
})
});
Properties
DataProtectionPolicy
Data Protection Policy for this log group.
public DataProtectionPolicy? DataProtectionPolicy { get; set; }
Property Value
Remarks
Default: - no data protection policy
DeletionProtectionEnabled
Indicates whether deletion protection is enabled for this log group.
public bool? DeletionProtectionEnabled { get; set; }
Property Value
bool?
Remarks
When enabled, deletion protection blocks all deletion operations until it is explicitly disabled.
Default: false
EncryptionKey
The KMS customer managed key to encrypt the log group with.
public IKeyRef? EncryptionKey { get; set; }
Property Value
Remarks
Default: Server-side encryption managed by the CloudWatch Logs service
FieldIndexPolicies
Field Index Policies for this log group.
public FieldIndexPolicy[]? FieldIndexPolicies { get; set; }
Property Value
Remarks
Default: - no field index policies for this log group.
LogGroupClass
The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.
public LogGroupClass? LogGroupClass { get; set; }
Property Value
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
Remarks
Default: Automatically generated
RemovalPolicy
Determine the removal policy of this log group.
public RemovalPolicy? RemovalPolicy { get; set; }
Property Value
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 RetentionDays? Retention { get; set; }
Property Value
Remarks
To retain all logs, set this value to RetentionDays.INFINITE.
Default: RetentionDays.TWO_YEARS