- Newest
- Most votes
- Most comments
When you have API Gateway execution logs set to ERROR level only with data tracing turned off, you won't see all 400 or 500 status codes returned from your Lambda function in the logs. This is because these status codes might be considered valid responses from your integration rather than actual execution errors.
To properly log these error responses, you need to:
-
Enable "Log full requests/responses data" in the execution logs settings. This is essential for capturing detailed information about requests and responses.
-
Consider changing your log level to INFO instead of just ERROR to capture more comprehensive logging information.
It's also important to note that API Gateway might not generate logs for certain error types, including:
- 413 Request Entity Too Large errors
- Excessive 429 Too Many Requests errors
- 400 series errors from requests sent to a custom domain without API mapping
- 500 series errors caused by internal failures
For client-side errors (like 400 series), API Gateway doesn't always log these in execution logs. In this case, you should enable CloudWatch access logging in addition to execution logging to get a complete picture of all errors.
You can configure these settings in the API Gateway console under the Logs/Tracing tab for your API stage, or through the AWS CLI or SDK.
Sources
Troubleshoot missing CloudWatch logs for API Gateway REST APIs | AWS re:Post
Troubleshoot API Gateway logs | AWS re:Post
Monitor REST APIs in API Gateway - Amazon API Gateway
Set up CloudWatch logging for REST APIs in API Gateway - Amazon API Gateway
answered a year ago
Relevant content
asked 3 years ago
asked a year ago
