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

17

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.

2
  • 3
    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
    – Constantin
    Sep 8, 2021 at 10:21
  • We have close to 2K lambda funcs, so this doesn't work for us. We get an error, "maximum number of allowed metrics exceeded"
    – grayaii
    Nov 5, 2021 at 16:07
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

4

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
  • 1
    This only applies if the OP is using serverless. Can you add that to your answer so future readers will not be confused? Dec 20, 2017 at 18:10
  • @dashmug Thanks for the correction! Updated my answer already. Dec 21, 2017 at 11:26
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.

-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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.