如何查看外部呼叫的AWS Gateway日志? [英] How can I see AWS Gateway logs for external calls?

查看:181
本文介绍了如何查看外部呼叫的AWS Gateway日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够查看 AWS API网关上的调用日志。当我从Gateway的仪表板中执行呼叫时,可以在 Logs 部分下看到它们。



如何查看他们用于外部通话(例如:使用 curl 进行的通话)?



我尝试启用CloudWatch,但只能看到指标,而不是实际的日志消息。

解决方案

最不可能在CloudWatch中看到API网关日志的原因日志是您尚未指定IAM角色的ARN,该API使API Gateway能够将信息写入CloudWatch Logs。





然后,您需要在每个阶段上明确启用日志记录。您无需重新部署API,只需保存。



此处的详细说明:


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.

解决方案

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.

这篇关于如何查看外部呼叫的AWS Gateway日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆