Customizing HTTP API access logs - Amazon API Gateway

Customizing HTTP API access logs

You can use the following variables to customize HTTP API access logs. To learn more about access logs for HTTP APIs, see Configuring logging for an HTTP API.

Parameter Description

The API owner's AWS account ID.


The identifier API Gateway assigns to your API.


A property of the claims returned from the JSON Web Token (JWT) after the method caller is successfully authenticated. For more information, see Controlling access to HTTP APIs with JWT authorizers.


Calling $ returns null.


The AWS endpoint's request ID.

$context.dataProcessed The amount of data processed in bytes.

The full domain name used to invoke the API. This should be the same as the incoming Host header.


The first label of the $context.domainName. This is often used as a caller/customer identifier.


A string that contains an API Gateway error message.

$context.error.messageString The quoted value of $context.error.message, namely "$context.error.message".

A type of GatewayResponse. For more information, see Monitoring WebSocket API execution with CloudWatch metrics and Setting up gateway responses to customize error responses.

$context.extendedRequestId The extended ID that API Gateway assigns to the API request, which contains more useful information for debugging/troubleshooting.

The HTTP method used. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT.


The source IP address of the TCP connection making the request to API Gateway.


You should not trust this value if there is any chance that the X-Forwarded-For header could be forged.


The User-Agent header of the API caller.

$context.path The request path. For example, /{stage}/root/child.
$context.protocol The request protocol, for example, HTTP/1.1.

The ID that API Gateway assigns to the API request.

$context.requestTime The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
$context.requestTimeEpoch The Epoch-formatted request time.

The route key of the API request, for example /pets.


The deployment stage of the API request (for example, beta or prod).


A string that contains an integration error message.

$context.integrationLatency The integration latency in ms.
$context.integrationStatus For Lambda proxy integration, this parameter represents the status code returned from AWS Lambda, not from the backend Lambda function.
$context.responseLatency The response latency in ms.
$context.responseLength The response payload length.
$context.status The method response status.