How can I set up access logging for API Gateway?
Last updated: 2022-08-15
I'm trying to set up access logging for Amazon API Gateway. How can I do this?
To debug issues related to request execution or client access to your API, you can activate Amazon CloudWatch Logs to log API calls.
Before you begin, make sure that you have:
- Deployed your API to a stage.
- Granted API Gateway permission to read and write logs to CloudWatch for your account.
Next, to activate access logging follow steps 1-5 and 7-8 (skip step 6) in the instructions for setting up CloudWatch API logging using the API Gateway console.
Note: It's a best practice not to log the full API requests and responses for production APIs. Full API requests and responses can result in logging sensitive data.
You now have CloudWatch logs activated for debugging. To find errors, see How do I find API Gateway REST API errors in my CloudWatch logs?
For more information, see Monitoring REST API execution with Amazon CloudWatch metrics.