Monitoring and Logging

An application already sends JSON logs to CloudWatch Logs. A team needs matching error events forwarded to an AWS Lambda function in near real time without polling. What should the team configure?

Show the answer

Correct answerB. A CloudWatch Logs subscription filter

AWhy not this: Scheduled queries retrieve stored events periodically rather than providing event-driven forwarding.

BWhy this is right: Subscription filters match incoming events and deliver them to destinations such as Lambda without polling.

CWhy not this: Export tasks deliver stored logs to Amazon S3 and are not intended for near-real-time Lambda processing.

DWhy not this: Metric filters generate metric data from matching logs; they do not forward the matching log events to Lambda.

A CloudWatch Logs subscription filter matches incoming log events and forwards them to a supported destination such as Lambda in near real time. A metric filter extracts metric values from matching events rather than forwarding the events themselves.