According the Customize HTTP API access logs, the logging variable $context.awsEndpointRequestId is populated from x-amz-request-id or x-amzn-requestId header.
I am directly hitting the my HTTP APIGateway endpoint by setting these headers, but the value is not being logged in the access logs. I am logging it as traceId.
The access log format is,
{
"requestId": "$context.requestId",
"traceId": "$context.awsEndpointRequestId",
"ip": "$context.identity.sourceIp",
"caller": "$context.identity.caller",
"user": "$context.identity.user",
"requestTime": "$context.requestTime",
"httpMethod": "$context.httpMethod",
"path": "$context.path",
"status": "$context.status",
"protocol": "$context.protocol",
"responseLength": "$context.responseLength",
"responseLatency": "$context.responseLatency"
}
This is the value being logged,
{
"requestId": "Slmybhv2BcwEMDw=",
"traceId": "-",
"ip": "<source_ip>",
"caller": "-",
"user": "-",
"requestTime": "17/Oct/2025:10:46:13 +0000",
"httpMethod": "GET",
"path": "/foo/bar",
"status": "200",
"protocol": "HTTP/1.1",
"responseLength": "17",
"responseLatency": "10"
}
I want to set a custom UUID4 as the endpoint request id which will be used to trace requests between services. What am I doing wrong?
asked Oct 17, 2025 at 11:36
gowthz
4692 gold badges10 silver badges25 bronze badges