AWS Fundamentals Logo
AWS Fundamentals
AWS::Logs::MetricFilter

Logs MetricFilter

The AWS::Logs::MetricFilter resource specifies a metric filter that describes how CWL 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.

Properties

7 configurable properties. 3 required. Click a row to see details.

Filter:
PropertyTypeFlags
FilterPattern
string
Required
LogGroupName
string
RequiredCreate-only
MetricTransformations
Array<MetricTransformation>
Required
ApplyOnTransformedLogs
boolean
EmitSystemFieldDimensions
Array<string>
FieldSelectionCriteria
string
FilterName
string
Create-only

Sample CloudFormation Template

A minimal template with required properties and common optional ones.

template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::Logs::MetricFilter

Resources:
  MyResource:
    Type: AWS::Logs::MetricFilter
    Properties:
      FilterPattern: "value"
      LogGroupName: "my-loggroupname"
      MetricTransformations: []

Required IAM Permissions

Permissions CloudFormation needs in your IAM role to manage this resource.

read

logs:DescribeMetricFilters

create

logs:PutMetricFilterlogs:DescribeMetricFilters

update

logs:PutMetricFilterlogs:DescribeMetricFilters

list

logs:DescribeMetricFilters

delete

logs:DeleteMetricFilter

Learn AWS the Practical Way

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

Subscribe to Newsletter

Quick Facts

ServiceLogs
Properties7
Required3
TaggingNot supported
Primary IDLogGroupName

Supported Operations

ReadCreateUpdateListDelete

Immutable After Creation

These properties cannot be changed after the resource is created. Updating them triggers a replacement.

FilterNameLogGroupName

External Links