interface MetricFilterProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Logs.MetricFilterProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#MetricFilterProps |
![]() | software.amazon.awscdk.services.logs.MetricFilterProps |
![]() | aws_cdk.aws_logs.MetricFilterProps |
![]() | aws-cdk-lib » aws_logs » MetricFilterProps |
Properties for a MetricFilter.
Example
new MetricFilter(this, 'MetricFilter', {
logGroup,
metricNamespace: 'MyApp',
metricName: 'Latency',
filterPattern: FilterPattern.all(
FilterPattern.exists('$.latency'),
FilterPattern.regexValue('$.message', '=', 'bind: address already in use'),
),
metricValue: '$.latency',
});
Properties
Name | Type | Description |
---|---|---|
filter | IFilter | Pattern to search for log events. |
log | ILog | The log group to create the filter on. |
metric | string | The name of the metric to emit. |
metric | string | The namespace of the metric to emit. |
apply | boolean | Whether the metric filter is applied on the tranformed logs. |
default | number | The value to emit if the pattern does not match a particular event. |
dimensions? | { [string]: string } | The fields to use as dimensions for the metric. |
filter | string | The name of the metric filter. |
metric | string | The value to emit for the metric. |
unit? | Unit | The unit to assign to the metric. |
filterPattern
Type:
IFilter
Pattern to search for log events.
logGroup
Type:
ILog
The log group to create the filter on.
metricName
Type:
string
The name of the metric to emit.
metricNamespace
Type:
string
The namespace of the metric to emit.
applyOnTransformedLogs?
Type:
boolean
(optional, default: false)
Whether the metric filter is applied on the tranformed logs.
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.
defaultValue?
Type:
number
(optional, default: No metric emitted.)
The value to emit if the pattern does not match a particular event.
dimensions?
Type:
{ [string]: string }
(optional, default: No dimensions attached to metrics.)
The fields to use as dimensions for the metric.
One metric filter can include as many as three dimensions.
filterName?
Type:
string
(optional, default: Cloudformation generated name.)
The name of the metric filter.
metricValue?
Type:
string
(optional, default: "1")
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'.
unit?
Type:
Unit
(optional, default: No unit attached to metrics.)
The unit to assign to the metric.