If you want API Gateway to log the HTTP requests it receives and the HTTP responses it returns, you can perform the operations described in this topic. Only dedicated instances support this feature.
To log HTTP requests and responses, log on to the API Gateway console. In the left-side navigation pane, choose . Click the API group that you want to manage and configure the settings on the API group details page.
-
Record request
headers: The names of the headers to log, separated by commas (,). Use an asterisk (*) to log all headers. Record Response Headers: Separate the names of the response headers that you want to record with commas (,). You can use an asterisk (*) to indicate all header names.Record Query Strings: Separate the names of the fields that you want to record with commas (,). You can use an asterisk (*) to indicate all field names.
After you apply the settings, the user log contains the following information:
region : cn-hangzhou
requestBody :
requestHandleTime : 2020-09-08T08:13:49Z
requestHeaders : {"testheader":"header","testlog":"log"}
requestId : xxx
requestProtocol : HTTP
requestQueryString : testquery=query
requestSize : 1369
responseBody :
responseHeaders : {}
responseSize : 220
Enabling these settings adds the following fields to the user log, depending on your configuration: requestBody, responseBody, requestHeaders, responseHeaders, and requestQueryString. API Gateway limits each log field to 10 KB and truncates any field that exceeds this limit.
Data cannot be logged as binary files.