AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Logs::MetricFilter

CfnMetricFilter

The `AWS::Logs::MetricFilter` resource specifies a metric filter that describes how CloudWatch Logs extracts information from logs and transforms it into Amazon CloudWatch metrics. If you have multiple metric filters that are associated with a log group, all the filters are applied to the log streams in that group. The maximum number of metric filters that can be associated with a log group is 100.

Import

import { CfnMetricFilter } from 'aws-cdk-lib/aws-logs';

Or use the module namespace:

import * as logs from 'aws-cdk-lib/aws-logs';
// logs.CfnMetricFilter

Properties

Configuration passed to the constructor as CfnMetricFilterProps.

filterPatternRequired
string

A filter pattern for extracting metric data out of ingested log events. For more information, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html) .

logGroupNameRequired
string | ILogGroupRef

The name of an existing log group that you want to associate with this metric filter.

metricTransformationsRequired
IResolvable | IResolvable | MetricTransformationProperty[]

The metric transformations.

applyOnTransformedLogsOptional
boolean | IResolvable

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see [PutTransformer](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutTransformer.html) . 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.

emitSystemFieldDimensionsOptional
string[]

The list of system fields that are emitted as additional dimensions in the generated metrics. Returns the `emitSystemFieldDimensions` value if it was specified when the metric filter was created.

fieldSelectionCriteriaOptional
string

The filter expression that specifies which log events are processed by this metric filter based on system fields. Returns the `fieldSelectionCriteria` value if it was specified when the metric filter was created.

filterNameOptional
string

The name of the metric filter.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter