How do I find 5xx errors from API Gateway in my CloudWatch logs?

2 minute read
0

I see 5xx errors in my Amazon API Gateway CloudWatch metrics. I want to find specific 5xx errors from API Gateway in my Amazon CloudWatch logs to troubleshoot.

Resolution

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

API Gateway CloudWatch metrics show the number of 5xx server-side errors captured in a given period. To identify specific 5xx errors from API Gateway, do the following:

  1. Enable execution logging and access logging in your Amazon CloudWatch Logs.
  2. Use either the filter-log-events AWS CLI command or CloudWatch Logs Insights to find specific 5xx errors from API Gateway.

Note: If you're troubleshooting 504 errors from API Gateway, see How can I troubleshoot API HTTP 504 timeout errors with API Gateway?

For information on how to use the filter-log-events command, see How do I find API Gateway REST API errors in my CloudWatch logs? For information on how to use CloudWatch Logs Insights, see Analyzing log data with CloudWatch Logs Insights.

Related information

Set up CloudWatch API logging using the API Gateway console

View API Gateway log events in the CloudWatch console