@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:40.696Z") @Stability(value=Stable) public class CfnLogGroup extends CfnResource implements IInspectable
The AWS::Logs::LogGroup resource specifies a log group. A log group defines common properties for log streams, such as their retention and access control rules. Each log stream must belong to one log group.
You can create up to 1,000,000 log groups per Region per account. You must use the following guidelines when naming a log group:
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.logs.*;
CfnLogGroup cfnLogGroup = CfnLogGroup.Builder.create(this, "MyCfnLogGroup")
.kmsKeyId("kmsKeyId")
.logGroupName("logGroupName")
.retentionInDays(123)
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnLogGroup.Builder
A fluent builder for
CfnLogGroup. |
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnLogGroup(software.constructs.Construct scope,
String id)
Create a new `AWS::Logs::LogGroup`.
|
|
CfnLogGroup(software.constructs.Construct scope,
String id,
CfnLogGroupProps props)
Create a new `AWS::Logs::LogGroup`.
|
protected |
CfnLogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnLogGroup(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
String |
getAttrArn()
The ARN of the log group, such as `arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*`.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getKmsKeyId()
The Amazon Resource Name (ARN) of the AWS KMS key to use when encrypting log data.
|
String |
getLogGroupName()
The name of the log group.
|
Number |
getRetentionInDays()
The number of days to retain the log events in the specified log group.
|
TagManager |
getTags()
An array of key-value pairs to apply to the log group.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setKmsKeyId(String value)
The Amazon Resource Name (ARN) of the AWS KMS key to use when encrypting log data.
|
void |
setLogGroupName(String value)
The name of the log group.
|
void |
setRetentionInDays(Number value)
The number of days to retain the log events in the specified log group.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnLogGroup(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnLogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnLogGroup(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
CfnLogGroupProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties.@Stability(value=Stable)
public CfnLogGroup(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrArn()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public TagManager getTags()
For more information, see Tag .
@Stability(value=Stable) @Nullable public String getKmsKeyId()
To associate an AWS KMS key with the log group, specify the ARN of that KMS key here. If you do so, ingested data is encrypted using this key. This association is stored as long as the data encrypted with the KMS key is still within CloudWatch Logs . This enables CloudWatch Logs to decrypt this data whenever it is requested.
If you attempt to associate a KMS key with the log group but the KMS key doesn't exist or is deactivated, you will receive an InvalidParameterException error.
Log group data is always encrypted in CloudWatch Logs . If you omit this key, the encryption does not use AWS KMS . For more information, see Encrypt log data in CloudWatch Logs using AWS Key Management Service
@Stability(value=Stable)
public void setKmsKeyId(@Nullable
String value)
To associate an AWS KMS key with the log group, specify the ARN of that KMS key here. If you do so, ingested data is encrypted using this key. This association is stored as long as the data encrypted with the KMS key is still within CloudWatch Logs . This enables CloudWatch Logs to decrypt this data whenever it is requested.
If you attempt to associate a KMS key with the log group but the KMS key doesn't exist or is deactivated, you will receive an InvalidParameterException error.
Log group data is always encrypted in CloudWatch Logs . If you omit this key, the encryption does not use AWS KMS . For more information, see Encrypt log data in CloudWatch Logs using AWS Key Management Service
@Stability(value=Stable) @Nullable public String getLogGroupName()
If you don't specify a name, AWS CloudFormation generates a unique ID for the log group.
@Stability(value=Stable)
public void setLogGroupName(@Nullable
String value)
If you don't specify a name, AWS CloudFormation generates a unique ID for the log group.
@Stability(value=Stable) @Nullable public Number getRetentionInDays()
Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, and 3653.
To set a log group to never have log events expire, use DeleteRetentionPolicy .
@Stability(value=Stable)
public void setRetentionInDays(@Nullable
Number value)
Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, and 3653.
To set a log group to never have log events expire, use DeleteRetentionPolicy .
Copyright © 2022. All rights reserved.