1
votes

I have a Cloudwatch scheduled java based Lambda that processes a few files everyday. Once the processing is completed, it sends an SNS message about processing status. This is all working fine.

Objective is to be aware of events when the processing failed, raised exceptions etc.

The current options are :

  1. Create a CloudWatch Alarm - works - not exactly that what I am looking for.

  2. Stream logs to another lambda that can send SNS alert - the lambda can monitor key words like ERROR, Exception etc.

  3. Catch exceptions and send them through the Lambda

I am trying to see if the Lambda logs can be monitored by Cloudwatch events as given at https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html

1

1 Answers

3
votes

You can use Dead Letter Queues

Any Lambda function invoked asynchronously is retried twice before the event is discarded. If the retries fail and you're unsure why, use Dead Letter Queues (DLQ) to direct unprocessed events to an Amazon SQSqueue or an Amazon SNS topic to analyze the failure.