1

As described in the question I want to query the cloud watch logs for the lambdas that are failed and succeeded after consequentive retry attempts to the same lambda, I couldn't figure this out , any approaches on how to achieve this ?

I tried and only got until querying lambda invoke failed logs in the cloud watch, pretty new to AWS

Edit: I have my lambdas in step function states

tejaswi
  • 77
  • 5

1 Answers1

1

You can't link a random invocation to another one even if the invocation occurs as a retry due to a failure. The reason is that each invocation gets its own request id.

To make this work, you need a way to map different invocations with each other. One way is to have your own request id based on the input.

If you log the same request id for multiple invocations, you can filter them using CloudWatch.


A different approach is to use Step Functions. If you add your Lambda function as a state, you can track the failures and retries easily.

Brian
  • 1,056
  • 9
  • 15
  • I have my lambdas in step function can you please elaborate on how to track retries on failures for step functions ? – tejaswi Jan 02 '23 at 09:10
  • 1
    You can add error catching logic in your state machine definition. See: https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html – Brian Jan 02 '23 at 09:11
  • I have retry logic for state machine, what's the property with which I can track retry count ? I can't see that in the docs https://docs.aws.amazon.com/step-functions/latest/dg/procedure-cw-metrics.html – tejaswi Jan 02 '23 at 09:18
  • The context object includes Retry Count: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html – Brian Jan 02 '23 at 09:25