Set up API Logging Using the API Gateway Console
To set up API logging, you must have deployed the API to a stage. You must also have configured an appropriate CloudWatch Logs role ARN for your account.
- Sign in to the API Gateway console at here.
- Choose Settings from the primary navigation panel and type an ARN of
an IAM role with appropriate permissions in CloudWatch log role ARN.
You need to do this once.
- Do one of the following:
- Choose an existing API and then choose a stage.
- Create an API and deploy it to a stage.
- Choose Logs/Tracing in the Stage Editor.
- To enable execution logging:
- Choose Enable CloudWatch Logs under CloudWatch Settings.
- Choose Error or Info from the dropdown menu.
- If desired, choose Enable Detailed CloudWatch Metrics.
For more information about CloudWatch metrics, see Monitor API Execution with Amazon CloudWatch.
- To enable access logging:
- Choose Enable Access Logging under Custom Access Logging.
- Type the ARN of a log group in CloudWatch Group. The ARN format is arn:aws:logs:{region}:{account-id}:log-group:API-Gateway-Execution-Logs_{rest-api-id}/{stage-name}.
- Type a log format in Log Format. You can choose CLF, JSON, XML, or CSV to use one of the provided examples as a guide.
- Choose Save Changes.
Note: You can enable execution logging and access logging independent of each other.
Reference: Set Up CloudWatch API Logging in API Gateway