All Products
Search
Document Center

API Gateway:Configure the logging of HTTP requests and responses

Last Updated:Jul 19, 2024

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.

You can enable this feature on the API group level. To do this, log on to the API Gateway console, choose Manage APIs > API Groups in the left-side navigation pane, click the API group that you want to manage, and configure parameters in the User Log Settings section on the API group details page. The following items describe the parameters:

image

  • Record Request Headers: Separate the names of the request headers that you want to record with commas (,). You can use an asterisk (*) to indicate all header names.

  • 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.

Then, you can view the related information in logs. The following figure shows a sample log:

日志

The following fields will be added to user logs based on the preceding settings: requestBody, responseBody, requestHeaders, responseHeaders, and queryString. Each field must be 10 KB or less in size. Excessive fields will be truncated before they are logged.

Note

Data cannot be logged as binary files.