17

I want to view AWS lambda last hour errors of two types:

  • Lambda function that finished with an error
  • Lambda function returned http 500

How should I do that?

5 Answers 5

21

If you have many lambdas, in can be difficult to identify exactly which lambda caused an error. Here is how to find it out, even if you have hundreds of lambdas.

In CloudWatch, go to the Metrics page, then go to the Graph Metrics tab, then navigate to the dropdown menu item “Math expression > Search > Lambda Throttles or Errors.”

This will give you error counts per lambda in a graph, mouse over to get the name of the offending lambda.

Sign up to request clarification or add additional context in comments.

3 Comments

Any way to also get a list of the logs containing the errors? Sometimes it's hard to find them when a lambda invokes 10000 times a minute
We have close to 2K lambda funcs, so this doesn't work for us. We get an error, "maximum number of allowed metrics exceeded"
For anyone in 2025, CloudWatch > Metrics > All metrics > Graphed metrics > Add math > Search > Lambda throttles or errors
5

Once you launched an AWS Lambda project, automatically that is watched by CloudWatch.

Lambda function that finished with an error

You can see Lambda function errors from monitoring tab on Lambda default view.

Lambda function returned http 500

I guess your Lambda function is WEB API. If your WEB API created by Lambda function, you need to output logs with standard output in order to see logging on CloudWatch.

Please find documents from Accessing Amazon CloudWatch Logs for AWS Lambda

Comments

5

NOTE: only if you use serverless:

Alternatively, you can monitor your lambda function logs using serverless cli.

For example, to get log in the past 1 hours:

sls logs -f functionName --startTime 1h

You also can filter based on the string 'error' in the past 1 hours:

sls logs -f functionName --startTime 1h --filter error

Please check on the doc.

2 Comments

This only applies if the OP is using serverless. Can you add that to your answer so future readers will not be confused?
@dashmug Thanks for the correction! Updated my answer already.
0

You could enable X-Ray traces from the lambda dashboard

Lambda Console Enable X-Ray Tracing

The X-Ray service displays trace mappings for lambda execution results. The service is great for checking the results of errors within lambda functions, but if you are looking for detailed error result logs, CloudWatch is your best bet.

Comments

-2

You could also try something like Logbird that processes CloudWatch streams for all errors in AWS Lambda, API Gateway and other cloud services and can trigger notifications.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.