Subscriptions
Overview
Subscriptions in CloudWatch Logs enable real-time delivery of log events to other AWS services such as Kinesis Data Streams, Kinesis Firehose, or AWS Lambda for further processing, analysis, or storage. These log events are base64 encoded and compressed using gzip before delivery.
How Subscriptions Work
Subscription Filter: Defines the filter pattern to select which log events to send to a specified destination service.
Supported Destinations:
Kinesis Data Streams: For continuous log processing.
Kinesis Firehose: For loading data into storage solutions.
AWS Lambda: For custom analysis or real-time responses.
Amazon OpenSearch Service: For streaming log data into search clusters.
Subscription Levels:
Log Group-Level: Each log group can have up to two subscription filters.
Account-Level: One account-wide filter can apply to multiple log groups with selection criteria.
Retries and Errors:
CloudWatch retries delivery for up to 24 hours for retryable errors (e.g., throttling).
For non-retryable errors (e.g., AccessDeniedException), the filter is temporarily disabled for 10 minutes.
Key Components of Subscription Filters:
Filter Pattern: Specifies how log data is interpreted and what events are sent to the destination.
Destination ARN: The Amazon Resource Name of the destination service (e.g., Kinesis or Lambda).
Role ARN: An IAM role with permissions to deliver logs to the destination. This is not required for Lambda.
Distribution: For Kinesis Data Streams, logs can be grouped by stream or distributed randomly.
Additional Concepts:
Cross-Account & Cross-Region Subscriptions: You can send log events to destinations in other accounts or regions.
Log Recursion Prevention: Selection criteria ensure that log loops are avoided by filtering logs appropriately.
Batching: CloudWatch may batch log events to optimize transmission, though batching is not guaranteed.
Monitoring and Limitations:
Subscriptions work only with Standard log class log groups.
Metrics are available to monitor the performance of log forwarding.
Account-Level Selection Criteria: If no criteria are specified, the subscription applies to all log groups in the account.
Last updated