interface MetricFilterProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Logs.MetricFilterProps |
Java | software.amazon.awscdk.services.logs.MetricFilterProps |
Python | aws_cdk.aws_logs.MetricFilterProps |
TypeScript (source) | @aws-cdk/aws-logs » MetricFilterProps |
Properties for a MetricFilter.
Example
new MetricFilter(this, 'MetricFilter', {
logGroup,
metricNamespace: 'MyApp',
metricName: 'Latency',
filterPattern: FilterPattern.exists('$.latency'),
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. |
default | number | The value to emit if the pattern does not match a particular event. |
metric | string | The value to emit for 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.
defaultValue?
Type:
number
(optional, default: No metric emitted.)
The value to emit if the pattern does not match a particular event.
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'.