Class CfnLogGroup
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.logs.CfnLogGroup
- All Implemented Interfaces:
IInspectable,IEnvironmentAware,ILogGroupRef,ITaggable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:39.843Z")
@Stability(Stable)
public class CfnLogGroup
extends CfnResource
implements IInspectable, ILogGroupRef, ITaggable
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:
- Log group names must be unique within a Region for an AWS account.
- Log group names can be between 1 and 512 characters long.
- Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
Example:
// Works across different resource types CfnBucket bucket = new CfnBucket(scope, "Bucket"); Mixins.of(bucket).apply(new EncryptionAtRest()); CfnLogGroup logGroup = new CfnLogGroup(scope, "LogGroup"); Mixins.of(logGroup).apply(new EncryptionAtRest());
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.logs.ILogGroupRef
ILogGroupRef.Jsii$Default, ILogGroupRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnLogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnLogGroup(software.amazon.jsii.JsiiObjectRef objRef) CfnLogGroup(software.constructs.Construct scope, String id) Create a newAWS::Logs::LogGroup.CfnLogGroup(software.constructs.Construct scope, String id, CfnLogGroupProps props) Create a newAWS::Logs::LogGroup. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForLogGroup(ILogGroupRef resource) static ILogGroupReffromLogGroupArn(software.constructs.Construct scope, String id, String arn) Creates a new ILogGroupRef from an ARN.static ILogGroupReffromLogGroupName(software.constructs.Construct scope, String id, String logGroupName) Creates a new ILogGroupRef from a logGroupName.The ARN of the log group, such asarn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*.Creates a data protection policy and assigns it to the log group.Creates or updates a field index policy for the specified log group.The Amazon Resource Name (ARN) of the AWS key to use when encrypting log data.Specifies the log group class for this log group.The name of the log group.A reference to a LogGroup resource.Creates or updates a resource policy for the specified log group that allows other services to put log events to this account.The number of days to retain the log events in the specified log group.getTags()Tag Manager which manages the tags for this resource.An array of key-value pairs to apply to the log group.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.static BooleanChecks whether the given object is a CfnLogGroup.renderProperties(Map<String, Object> props) voidsetDataProtectionPolicy(Object value) Creates a data protection policy and assigns it to the log group.voidsetFieldIndexPolicies(List<Object> value) Creates or updates a field index policy for the specified log group.voidsetFieldIndexPolicies(IResolvable value) Creates or updates a field index policy for the specified log group.voidsetKmsKeyId(String value) The Amazon Resource Name (ARN) of the AWS key to use when encrypting log data.voidsetLogGroupClass(String value) Specifies the log group class for this log group.voidsetLogGroupName(String value) The name of the log group.voidsetResourcePolicyDocument(Object value) Creates or updates a resource policy for the specified log group that allows other services to put log events to this account.voidsetRetentionInDays(Number value) The number of days to retain the log events in the specified log group.voidsetTagsRaw(List<CfnTag> value) An array of key-value pairs to apply to the log group.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnLogGroup
protected CfnLogGroup(software.amazon.jsii.JsiiObjectRef objRef) -
CfnLogGroup
protected CfnLogGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnLogGroup
@Stability(Stable) public CfnLogGroup(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnLogGroupProps props) Create a newAWS::Logs::LogGroup.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnLogGroup
@Stability(Stable) public CfnLogGroup(@NotNull software.constructs.Construct scope, @NotNull String id) Create a newAWS::Logs::LogGroup.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
arnForLogGroup
- Parameters:
resource- This parameter is required.
-
fromLogGroupArn
@Stability(Stable) @NotNull public static ILogGroupRef fromLogGroupArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String arn) Creates a new ILogGroupRef from an ARN.- Parameters:
scope- This parameter is required.id- This parameter is required.arn- This parameter is required.
-
fromLogGroupName
@Stability(Stable) @NotNull public static ILogGroupRef fromLogGroupName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String logGroupName) Creates a new ILogGroupRef from a logGroupName.- Parameters:
scope- This parameter is required.id- This parameter is required.logGroupName- This parameter is required.
-
isCfnLogGroup
Checks whether the given object is a CfnLogGroup.- Parameters:
x- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrArn
The ARN of the log group, such asarn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getLogGroupRef
A reference to a LogGroup resource.- Specified by:
getLogGroupRefin interfaceILogGroupRef
-
getTags
Tag Manager which manages the tags for this resource. -
getDataProtectionPolicy
Creates a data protection policy and assigns it to the log group. -
setDataProtectionPolicy
Creates a data protection policy and assigns it to the log group. -
getFieldIndexPolicies
Creates or updates a field index policy for the specified log group.Returns union: either Listinvalid input: '<'
Object> orIResolvable -
setFieldIndexPolicies
Creates or updates a field index policy for the specified log group. -
setFieldIndexPolicies
Creates or updates a field index policy for the specified log group. -
getKmsKeyId
The Amazon Resource Name (ARN) of the AWS key to use when encrypting log data. -
setKmsKeyId
The Amazon Resource Name (ARN) of the AWS key to use when encrypting log data. -
getLogGroupClass
Specifies the log group class for this log group.There are two classes:.
-
setLogGroupClass
Specifies the log group class for this log group.There are two classes:.
-
getLogGroupName
The name of the log group. -
setLogGroupName
The name of the log group. -
getResourcePolicyDocument
Creates or updates a resource policy for the specified log group that allows other services to put log events to this account. -
setResourcePolicyDocument
Creates or updates a resource policy for the specified log group that allows other services to put log events to this account. -
getRetentionInDays
The number of days to retain the log events in the specified log group. -
setRetentionInDays
The number of days to retain the log events in the specified log group. -
getTagsRaw
An array of key-value pairs to apply to the log group. -
setTagsRaw
An array of key-value pairs to apply to the log group.
-