How do I find 5xx errors from API Gateway in my CloudWatch logs?
Last updated: 2021-03-23
I keep seeing 5xx errors in my Amazon API Gateway CloudWatch metrics. How do I find specific 5xx errors from API Gateway in my Amazon CloudWatch logs?
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:
- Enable execution logging and access logging in your Amazon CloudWatch Logs.
- 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 do I troubleshoot HTTP 504 errors from my API Gateway REST API?
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.