LogGroupProps
- class aws_cdk.aws_logs.LogGroupProps(*, data_protection_policy=None, deletion_protection_enabled=None, encryption_key=None, field_index_policies=None, log_group_class=None, log_group_name=None, removal_policy=None, retention=None)
Bases:
objectProperties for a LogGroup.
- Parameters:
data_protection_policy (
Optional[DataProtectionPolicy]) – Data Protection Policy for this log group. Default: - no data protection policydeletion_protection_enabled (
Optional[bool]) – Indicates whether deletion protection is enabled for this log group. When enabled, deletion protection blocks all deletion operations until it is explicitly disabled. Default: falseencryption_key (
Optional[IKeyRef]) – The KMS customer managed key to encrypt the log group with. Default: Server-side encryption managed by the CloudWatch Logs servicefield_index_policies (
Optional[Sequence[FieldIndexPolicy]]) – Field Index Policies for this log group. Default: - no field index policies for this log group.log_group_class (
Optional[LogGroupClass]) – The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS. 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.STANDARDlog_group_name (
Optional[str]) – Name of the log group. Default: Automatically generatedremoval_policy (
Optional[RemovalPolicy]) – Determine the removal policy of this log group. 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.Retainretention (
Optional[RetentionDays]) – How long, in days, the log contents will be retained. To retain all logs, set this value to RetentionDays.INFINITE. Default: RetentionDays.TWO_YEARS
- ExampleMetadata:
infused
Example:
# my_role: iam.Role cr.AwsCustomResource(self, "Customized", role=my_role, # must be assumable by the `lambda.amazonaws.com` service principal timeout=Duration.minutes(10), # defaults to 2 minutes memory_size=1025, # defaults to 512 if installLatestAwsSdk is true log_group=logs.LogGroup(self, "AwsCustomResourceLogs", retention=logs.RetentionDays.ONE_DAY ), function_name="my-custom-name", # defaults to a CloudFormation generated name removal_policy=RemovalPolicy.RETAIN, # defaults to `RemovalPolicy.DESTROY` policy=cr.AwsCustomResourcePolicy.from_sdk_calls( resources=cr.AwsCustomResourcePolicy.ANY_RESOURCE ) )
Attributes
- data_protection_policy
Data Protection Policy for this log group.
- Default:
no data protection policy
- deletion_protection_enabled
Indicates whether deletion protection is enabled for this log group.
When enabled, deletion protection blocks all deletion operations until it is explicitly disabled.
- Default:
false
- encryption_key
The KMS customer managed key to encrypt the log group with.
- Default:
Server-side encryption managed by the CloudWatch Logs service
- field_index_policies
Field Index Policies for this log group.
- Default:
no field index policies for this log group.
- log_group_class
STANDARD and INFREQUENT_ACCESS.
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
- Type:
The class of the log group. Possible values are
- log_group_name
Name of the log group.
- Default:
Automatically generated
- removal_policy
Determine the removal policy of this log group.
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.
To retain all logs, set this value to RetentionDays.INFINITE.
- Default:
RetentionDays.TWO_YEARS