CloudWatch中的AWS API Gateway $输入变量

时间:2018-03-07 02:48:53

标签: amazon-web-services aws-api-gateway amazon-cloudwatch

是否可以从CloudWatch将请求的$input variable(正文变量)记录到API网关?

自定义访问日志记录的日志格式似乎不接受$ input.body或任何其他$ input函数:

{"requestId": "$context.requestId",  "ip": "$context.identity.sourceIp",  "caller": "$context.identity.caller",  "user": "$context.identity.user",  "requestTime": "$context.requestTime",  "httpMethod": "$context.httpMethod",  "resourcePath": "$context.resourcePath",  "status": "$context.status",  "protocol": "$context.protocol",  "responseLength": "$context.responseLength", "body": "$input.body", params: "$input.params()"}

1 个答案:

答案 0 :(得分:0)

简短回答:否

您可以按照访问记录中的说明使用var dlg = NSSavePanel.SavePanel; dlg.NameFieldStringValue = defaultFileName; 变量

https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html

不支持其他变量,包括$context。如果要记录请求/响应标头值,则可以在启用“记录完整的请求/响应数据”的情况下使用执行记录。