Class MetricFilter.Builder

java.lang.Object
software.amazon.awscdk.services.logs.MetricFilter.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<MetricFilter>
Enclosing class:
MetricFilter

@Stability(Stable) public static final class MetricFilter.Builder extends Object implements software.amazon.jsii.Builder<MetricFilter>
A fluent builder for MetricFilter.
  • Method Details

    • create

      @Stability(Stable) public static MetricFilter.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of MetricFilter.Builder.
    • filterPattern

      @Stability(Stable) public MetricFilter.Builder filterPattern(IFilterPattern filterPattern)
      Pattern to search for log events.

      Parameters:
      filterPattern - Pattern to search for log events. This parameter is required.
      Returns:
      this
    • metricName

      @Stability(Stable) public MetricFilter.Builder metricName(String metricName)
      The name of the metric to emit.

      Parameters:
      metricName - The name of the metric to emit. This parameter is required.
      Returns:
      this
    • metricNamespace

      @Stability(Stable) public MetricFilter.Builder metricNamespace(String metricNamespace)
      The namespace of the metric to emit.

      Parameters:
      metricNamespace - The namespace of the metric to emit. This parameter is required.
      Returns:
      this
    • defaultValue

      @Stability(Stable) public MetricFilter.Builder defaultValue(Number defaultValue)
      The value to emit if the pattern does not match a particular event.

      Default: No metric emitted.

      Parameters:
      defaultValue - The value to emit if the pattern does not match a particular event. This parameter is required.
      Returns:
      this
    • dimensions

      @Stability(Stable) public MetricFilter.Builder dimensions(Map<String,String> dimensions)
      The fields to use as dimensions for the metric.

      One metric filter can include as many as three dimensions.

      Default: - No dimensions attached to metrics.

      Parameters:
      dimensions - The fields to use as dimensions for the metric. This parameter is required.
      Returns:
      this
      See Also:
    • filterName

      @Stability(Stable) public MetricFilter.Builder filterName(String filterName)
      The name of the metric filter.

      Default: - Cloudformation generated name.

      Parameters:
      filterName - The name of the metric filter. This parameter is required.
      Returns:
      this
    • metricValue

      @Stability(Stable) public MetricFilter.Builder metricValue(String metricValue)
      The value to emit for the metric.

      Can either be a literal number (typically "1"), or the name of a field in the structure to take the value from the matched event. If you are using a field value, the field value must have been matched using the pattern.

      If you want to specify a field from a matched JSON structure, use '$.fieldName', and make sure the field is in the pattern (if only as '$.fieldName = *').

      If you want to specify a field from a matched space-delimited structure, use '$fieldName'.

      Default: "1"

      Parameters:
      metricValue - The value to emit for the metric. This parameter is required.
      Returns:
      this
    • unit

      @Stability(Stable) public MetricFilter.Builder unit(Unit unit)
      The unit to assign to the metric.

      Default: - No unit attached to metrics.

      Parameters:
      unit - The unit to assign to the metric. This parameter is required.
      Returns:
      this
      See Also:
    • logGroup

      @Stability(Stable) public MetricFilter.Builder logGroup(ILogGroup logGroup)
      The log group to create the filter on.

      Parameters:
      logGroup - The log group to create the filter on. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public MetricFilter build()
      Specified by:
      build in interface software.amazon.jsii.Builder<MetricFilter>
      Returns:
      a newly built instance of MetricFilter.