0

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

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.