Interface CfnMetricFilter.MetricTransformationProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnMetricFilter.MetricTransformationProperty.Jsii$Proxy
Enclosing class:
CfnMetricFilter

@Stability(Stable) public static interface CfnMetricFilter.MetricTransformationProperty extends software.amazon.jsii.JsiiSerializable
MetricTransformation is a property of the AWS::Logs::MetricFilter resource that describes how to transform log streams into a CloudWatch metric.

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.*;
 MetricTransformationProperty metricTransformationProperty = 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();
 
  • Method Details

    • getMetricName

      @Stability(Stable) @NotNull String getMetricName()
      The name of the CloudWatch metric.
    • getMetricNamespace

      @Stability(Stable) @NotNull String getMetricNamespace()
      A custom namespace to contain your metric in CloudWatch.

      Use namespaces to group together metrics that are similar. For more information, see Namespaces .

    • getMetricValue

      @Stability(Stable) @NotNull String getMetricValue()
      The value that is published to the CloudWatch metric.

      For example, if you're counting the occurrences of a particular term like Error , specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as $.size .

    • getDefaultValue

      @Stability(Stable) @Nullable default Number getDefaultValue()
      (Optional) The value to emit when a filter pattern does not match a log event.

      This value can be null.

    • getDimensions

      @Stability(Stable) @Nullable default Object getDimensions()
      The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

      Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

      CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges.

      You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated AWS Charges .

    • getUnit

      @Stability(Stable) @Nullable default String getUnit()
      The unit to assign to the metric.

      If you omit this, the unit is set as None .

    • builder

      @Stability(Stable) static CfnMetricFilter.MetricTransformationProperty.Builder builder()
      Returns:
      a CfnMetricFilter.MetricTransformationProperty.Builder of CfnMetricFilter.MetricTransformationProperty