小编Phi*_*hil的帖子

AWS API网关:访问日志中的日志查询字符串

我在AWS API Gateway中为我的API启用了Access Logging to CloudWatch,并且工作正常.但是,它只会记录URL的路径部分而不是我的查询字符串参数.

我的日志格式如下所示:

[$context.requestTime] ($context.status) "$context.httpMethod $context.path $context.requestId
Run Code Online (Sandbox Code Playgroud)

比方说,我这样调用我的API:

GET http://my.server.com/details?id=123
Run Code Online (Sandbox Code Playgroud)

相应的访问日志行如下所示:

[19/Jun/2018:06:09:27 +0000] (200) "GET /details 5229a43c-7387-11e8-xxxx-xxxxxxxx
Run Code Online (Sandbox Code Playgroud)

我也需要id = 123,但我无法弄清楚如何访问它.文档建议使用$input.params('id'),但总会返回-.

amazon-web-services aws-api-gateway

7
推荐指数
1
解决办法
772
查看次数