MetricFilterOptions Struct
Properties for a MetricFilter created from a LogGroup.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
declare const filterPattern: logs.IFilterPattern;
const metricFilterOptions: logs.MetricFilterOptions = {
filterPattern: filterPattern,
metricName: 'metricName',
metricNamespace: 'metricNamespace',
// the properties below are optional
applyOnTransformedLogs: false,
defaultValue: 123,
dimensions: {
dimensionsKey: 'dimensions',
},
filterName: 'filterName',
metricValue: 'metricValue',
unit: cloudwatch.Unit.SECONDS,
};
Properties
applyOnTransformedLogsbooleanapply_on_transformed_logsboolapplyOnTransformedLogsBooleanApplyOnTransformedLogsboolApplyOnTransformedLogs*bool= false#This parameter is valid only for log groups that have an active log transformer. If this value is true, the metric filter is applied on the transformed version of the log events instead of the original ingested log events.
defaultValuenumberdefault_valueint | floatdefaultValueNumberDefaultValuedoubleDefaultValue*float64= No metric emitted.#dimensions{ [key: string]: string }dimensionstyping.Mapping[str, str]dimensionsMap<String, String>DimensionsIDictionary<string, string>Dimensions*map[string]*string= No dimensions attached to metric…#One metric filter can include as many as three dimensions.
default
Default: No dimensions attached to metrics.
filterNamestringfilter_namestrfilterNameStringFilterNamestringFilterName*string= Cloudformation generated name.#filterPatternIFilterPatternfilter_patternIFilterPatternfilterPatternIFilterPatternFilterPatternIFilterPatternFilterPatternIFilterPatternrequired#metricNamespacestringmetric_namespacestrmetricNamespaceStringMetricNamespacestringMetricNamespace*stringrequired#notes
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 '
If you want to specify a field from a matched space-delimited structure, use '$fieldName'.