Skip to content

CloudWatchLogsClient.put_metric_filter

rboto-cloudwatch-logs==0.4.0 · Service index · Types

Model summary (excerpt): 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 PutLogEvents . The maximum number of metric filters that can be associated with a log group is 100. Using regular expressions in filter patterns is supported. For these filters, there is a quota of two regular...

Install and imports

python -m pip install "rboto[cloudwatch-logs]==0.4.0"
from rboto import CloudWatchLogsClient
from collections.abc import Sequence
from rboto_cloudwatch_logs.types import (
    MetricTransformation,
)

Signature

async def put_metric_filter(
    *,
    log_group_name: str,
    filter_name: str,
    filter_pattern: str,
    metric_transformations: Sequence[MetricTransformation],
    apply_on_transformed_logs: bool | None = None,
    field_selection_criteria: str | None = None,
    emit_system_field_dimensions: Sequence[str] | None = None,
) -> None: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
log_group_name Yes The name of the log group.
filter_name Yes A name for the metric filter.
filter_pattern Yes A filter pattern for extracting metric data out of ingested log events.
metric_transformations Yes A collection of information that defines how metric data gets emitted.
apply_on_transformed_logs No This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer . 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.
field_selection_criteria No 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.
emit_system_field_dimensions No 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.

Output

None.

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

MetricTransformation

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch_logs.exceptions:

InvalidOperationError, InvalidParameterError, LimitExceededError, OperationAbortedError, ResourceNotFoundError, ServiceUnavailableError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model