Class CfnMetricFilter
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.CfnMetricFilter
- All Implemented Interfaces:
IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.110.0 (build 336b265)",
date="2025-04-22T23:08:15.995Z")
@Stability(Stable)
public class CfnMetricFilter
extends CfnResource
implements IInspectable
The
AWS::Logs::MetricFilter resource specifies a metric filter that describes how CloudWatch Logs extracts information from logs and transforms it into Amazon CloudWatch metrics.
If you have multiple metric filters that are associated with a log group, all the filters are applied to the log streams in that group.
The maximum number of metric filters that can be associated with a log group is 100.
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.*;
CfnMetricFilter cfnMetricFilter = CfnMetricFilter.Builder.create(this, "MyCfnMetricFilter")
.filterPattern("filterPattern")
.logGroupName("logGroupName")
.metricTransformations(List.of(MetricTransformationProperty.builder()
.metricName("metricName")
.metricNamespace("metricNamespace")
.metricValue("metricValue")
// the properties below are optional
.defaultValue(123)
.dimensions(List.of(DimensionProperty.builder()
.key("key")
.value("value")
.build()))
.unit("unit")
.build()))
// the properties below are optional
.applyOnTransformedLogs(false)
.filterName("filterName")
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnMetricFilter.static interfaceSpecifies the CloudWatch metric dimensions to publish with this metric.static interfaceMetricTransformationis a property of theAWS::Logs::MetricFilterresource that describes how to transform log streams into a CloudWatch metric.Nested 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$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnMetricFilter(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnMetricFilter(software.amazon.jsii.JsiiObjectRef objRef) CfnMetricFilter(software.constructs.Construct scope, String id, CfnMetricFilterProps props) -
Method Summary
Modifier and TypeMethodDescriptionThis parameter is valid only for log groups that have an active log transformer.The name of the metric filter.A filter pattern for extracting metric data out of ingested log events.The name of an existing log group that you want to associate with this metric filter.The metric transformations.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetApplyOnTransformedLogs(Boolean value) This parameter is valid only for log groups that have an active log transformer.voidThis parameter is valid only for log groups that have an active log transformer.voidsetFilterName(String value) The name of the metric filter.voidsetFilterPattern(String value) A filter pattern for extracting metric data out of ingested log events.voidsetLogGroupName(String value) The name of an existing log group that you want to associate with this metric filter.voidsetMetricTransformations(List<Object> value) The metric transformations.voidThe metric transformations.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, 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.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnMetricFilter
protected CfnMetricFilter(software.amazon.jsii.JsiiObjectRef objRef) -
CfnMetricFilter
protected CfnMetricFilter(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnMetricFilter
@Stability(Stable) public CfnMetricFilter(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnMetricFilterProps props) - 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. This parameter is required.
-
-
Method Details
-
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.
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getFilterPattern
A filter pattern for extracting metric data out of ingested log events. -
setFilterPattern
A filter pattern for extracting metric data out of ingested log events. -
getLogGroupName
The name of an existing log group that you want to associate with this metric filter. -
setLogGroupName
The name of an existing log group that you want to associate with this metric filter. -
getMetricTransformations
The metric transformations. -
setMetricTransformations
The metric transformations. -
setMetricTransformations
The metric transformations. -
getApplyOnTransformedLogs
This parameter is valid only for log groups that have an active log transformer. -
setApplyOnTransformedLogs
This parameter is valid only for log groups that have an active log transformer. -
setApplyOnTransformedLogs
This parameter is valid only for log groups that have an active log transformer. -
getFilterName
The name of the metric filter. -
setFilterName
The name of the metric filter.
-