Skip to contents

Creates or updates a metric filter and associates it with the specified log group. With metric filters, you can configure rules to extract metric data from log events ingested through put_log_events.

See https://www.paws-r-sdk.com/docs/cloudwatchlogs_put_metric_filter/ for full documentation.

Usage

cloudwatchlogs_put_metric_filter(
  logGroupName,
  filterName,
  filterPattern,
  metricTransformations,
  applyOnTransformedLogs = NULL,
  fieldSelectionCriteria = NULL,
  emitSystemFieldDimensions = NULL
)

Arguments

logGroupName

[required] The name of the log group.

filterName

[required] A name for the metric filter.

filterPattern

[required] A filter pattern for extracting metric data out of ingested log events.

metricTransformations

[required] A collection of information that defines how metric data gets emitted.

applyOnTransformedLogs

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see put_transformer.

If the log group uses either a log-group level or account-level transformer, and you specify true, the metric filter will be applied on the transformed version of the log events instead of the original ingested log events.

fieldSelectionCriteria

A filter expression that specifies which log events should be processed by this metric filter based on system fields such as source account and source region. Uses selection criteria syntax with operators like =, !=, AND, OR, IN, NOT IN. Example: @aws.region = "us-east-1" or @aws.account IN ["123456789012", "987654321098"]. Maximum length: 2000 characters.

emitSystemFieldDimensions

A list of system fields to emit as additional dimensions in the generated metrics. Valid values are @aws.account and @aws.region. These dimensions help identify the source of centralized log data and count toward the total dimension limit for metric filters.