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 Summary
Modifier and TypeMethodDescriptionbuild()
static MetricFilter.Builder
defaultValue
(Number defaultValue) The value to emit if the pattern does not match a particular event.dimensions
(Map<String, String> dimensions) The fields to use as dimensions for the metric.filterName
(String filterName) The name of the metric filter.filterPattern
(IFilterPattern filterPattern) Pattern to search for log events.The log group to create the filter on.metricName
(String metricName) The name of the metric to emit.metricNamespace
(String metricNamespace) The namespace of the metric to emit.metricValue
(String metricValue) The value to emit for the metric.The unit to assign to the metric.
-
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
Pattern to search for log events.- Parameters:
filterPattern
- Pattern to search for log events. This parameter is required.- Returns:
this
-
metricName
The name of the metric to emit.- Parameters:
metricName
- The name of the metric to emit. This parameter is required.- Returns:
this
-
metricNamespace
The namespace of the metric to emit.- Parameters:
metricNamespace
- The namespace of the metric to emit. This parameter is required.- Returns:
this
-
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
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
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
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
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
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
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<MetricFilter>
- Returns:
- a newly built instance of
MetricFilter
.
-