How can I see AWS Gateway logs for external calls?

2020-07-03 08:15发布

问题:

I need to be able to see the logs for my calls on AWS API Gateway. When I perform the calls from within Gateway's Dashboard I can see them under the Logs section.

How can I see them for external call (e.g.: calls made using curl)?

I tried enabling CloudWatch but I can only see the metric, and not the actual log messages.

回答1:

The most likely reason for not being able to see API Gateway logs in CloudWatch logs is that you haven't specified the ARN of an IAM role that enables API Gateway to write information to CloudWatch Logs.

You then need to explicitly enable logging on each Stage. You don't need to (re)Deploy the API, just Save.

Detailed instructions here: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console

Once enabled you will get a log group named "/aws/apigateway/welcome" with a log line confirming logs are enabled.