Class CfnMetricFilter

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:19.577Z") @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
         .filterName("filterName")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getFilterPattern

      @Stability(Stable) @NotNull public String getFilterPattern()
      A filter pattern for extracting metric data out of ingested log events.
    • setFilterPattern

      @Stability(Stable) public void setFilterPattern(@NotNull String value)
      A filter pattern for extracting metric data out of ingested log events.
    • getLogGroupName

      @Stability(Stable) @NotNull public String getLogGroupName()
      The name of an existing log group that you want to associate with this metric filter.
    • setLogGroupName

      @Stability(Stable) public void setLogGroupName(@NotNull String value)
      The name of an existing log group that you want to associate with this metric filter.
    • getMetricTransformations

      @Stability(Stable) @NotNull public Object getMetricTransformations()
      The metric transformations.
    • setMetricTransformations

      @Stability(Stable) public void setMetricTransformations(@NotNull IResolvable value)
      The metric transformations.
    • setMetricTransformations

      @Stability(Stable) public void setMetricTransformations(@NotNull List<Object> value)
      The metric transformations.
    • getFilterName

      @Stability(Stable) @Nullable public String getFilterName()
      The name of the metric filter.
    • setFilterName

      @Stability(Stable) public void setFilterName(@Nullable String value)
      The name of the metric filter.