Skip to content

CloudWatchLogsClient.put_subscription_filter

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

Model summary (excerpt): Creates or updates a subscription filter and associates it with the specified log group. With subscription filters, you can subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. When log events are sent to the receiving service, they are Base64 encoded and compressed with the GZIP format. The following destinations are...

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 (
    Distribution,
)

Signature

async def put_subscription_filter(
    *,
    log_group_name: str,
    filter_name: str,
    filter_pattern: str,
    destination_arn: str,
    role_arn: str | None = None,
    distribution: Distribution | None = None,
    apply_on_transformed_logs: bool | None = None,
    field_selection_criteria: str | None = None,
    emit_system_fields: 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 subscription filter. If you are updating an existing filter, you must specify the correct name in filterName . To find the name of the filter currently associated with a log group, use DescribeSubscriptionFilters .
filter_pattern Yes A filter pattern for subscribing to a filtered stream of log events.
destination_arn Yes The ARN of the destination to deliver matching log events to. Currently, the supported destinations are: An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery. A logical destination (specified using an ARN) belonging to a different account, for cross-account delivery. If you're setting up a cross-account subscription, the destination must...
role_arn No The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
distribution No The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to random for a more even distribution. This property is only applicable when the destination is an Amazon Kinesis data stream.
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 subscription 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 subscription 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 NOT IN ["cn-north-1"] or @aws.account = "123456789012" AND @aws.region = "us-east-1" . Maximum length: 2000 characters.
emit_system_fields No A list of system fields to include in the log events sent to the subscription destination. Valid values are @aws.account , @aws.region , and @source.log . These fields provide source information for centralized log data in the forwarded payload.

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.

Distribution

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