I have a REST API exposed in API Gateway and those requests have path params and query params. I want to store some data from the request in CloudWatch.
In the settings I have checked the Log full requests/responses data option.
In the Custom Access Logging I have checked Enable Access Logging and this log format
:
{"requestId":"$context.requestId", "carId":"method.request.querystring.carId","color":"$input.params('color')"}
But in CloudWatch the result is:
{"requestId":"XXXXXX", "carId":"-","color":"-"}
Following the AWS documentation: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference%3Fcmpid=docs_apigateway_console
The request is: https://test.domain.demo/v1/cars/123456/data?color=red
Why I am getting a -
instead of the correct value?