CloudWatch中的AWS API Gateway $ input变量

lee*_*ion 7 amazon-web-services amazon-cloudwatch aws-api-gateway

是否可以将请求的$ input变量(主体变量)从CloudWatch记录到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()"}
Run Code Online (Sandbox Code Playgroud)

Ces*_*ssa 4

简短回答:否

您可以$context在访问日志记录中使用变量,如中所述

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

$input不支持其他变量。如果要记录请求/响应标头值,可以使用执行日志记录并启用“记录完整请求/响应数据”。