All Products
Search
Document Center

API Gateway:QueryRequestLogs

Last Updated:Jul 31, 2025

Queries the request logs of a user.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
apigateway:QueryRequestLogsget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RequestLogIdstringYes

The ID of the request log.

95657ED9-2F6F-426F-BD99-79C8********

Response parameters

ParameterTypeDescriptionExample
object

The returned data.

RequestIdstring

The ID of the request.

CE5722A6-AE78-4741-A9B0-6C81********
RequestLogsarray<object>

The request logs.

RequestLogobject

The request log.

ApiIdstring

The API ID.

4b83229ebcab4ecd88956fb3********
ApiNamestring

The API name.

ApiName
ConsumerAppKeystring

The App Key that is used by the caller.

20412****
TotalLatencystring

The total time consumed by the request. Unit: milliseconds.

1345
HttpMethodstring

The HTTP method that is used to send the request.

POST
Domainstring

The requested domain name in the request.

360bdd88695c48ae8085c7f2********-ap-southeast-1.alicloudapi.com
ErrorMessagestring

The error message returned if the call fails.

Backend service connect failed `Timeout connecting to [/1XX.20.0.XX:8080]`
ConsumerAppIdstring

The application ID that is used by the caller.

11096****
InstanceIdstring

The ID of the API Gateway instance to which the API belongs.

apigateway-bj-ab2b********
ClientNoncestring

The X-Ca-Nonce header included in the request from the client.

d43df9db-3b05-4cd6-888a-1c0b********
RequestSizestring

The size of the request. Unit: bytes.

1923
StageIdstring

The ID of the API environment.

8a305b7f10334052a52d9156********
StageNamestring

The name of the API environment.

RELEASE
HttpPathstring

The path of the request.

/testPath
RequestIdstring

The request ID.

95657ED9-2F6F-426F-BD99-79C8********
GroupIdstring

The ID of the API group to which the API belongs.

dc024277fe6c4cada79ba0bd6********
GroupNamestring

The name of the API group to which the API belongs.

GroupName
ErrorCodestring

The error code that is returned.

X500ER
ResponseSizestring

The size of returned data. Unit: bytes.

23441
Regionstring

The region in which the instance resides.

cn-hangzhou
StatusCodestring

The status code returned.

200
ClientIpstring

The IP address of the client that sends the request.

21.237.XXX.XXX
ServiceLatencystring

The total time consumed to access the backend resources. The total time includes the time consumed to request a connection to the resources, the time consumed to establish the connection, and the time consumed to call the backend service. Unit: milliseconds.

324
RequestTimestring

The request time, in UTC.

2022-10-29T03:59:59Z
Exceptionstring

The specific error message returned by the backend service.

error msg
CustomTraceIdstring

The custom trace ID.

95657ED9-2F6F-426F-BD99-79C8********
JwtClaimsstring

The JSON web token (JWT) claims. The claims can be configured at the group level.

{}
RequestProtocolstring

The protocol used by the client to send the request. Valid values: HTTP, HTTPS, and WS.

HTTP
RequestHeadersstring

The request headers.

content-type: application/x-www-form-urlencoded
RequestQueryStringstring

The query string for the request.

username=name
RequestBodystring

The request body. A request body cannot exceed 1,024 bytes in size.

param=paramName
ResponseHeadersstring

The headers in the API response.

content-type: application/x-www-form-urlencoded
ResponseBodystring

The response body. A response body cannot exceed 1,024 bytes in size.

param=paramName
pluginstring

The plug-in hit by the request and the relevant context.

[]
InitialRequestIdstring

The initial request ID when API Gateway calls an API. For example, if API-1 calls API-2, the initialRequestId parameter in the log of API-2 indicates the ID of the request from API-1.

95657ED9-2F6F-426F-BD99-79C8********
AppNamestring

The application name.

VIPROOM_VIPROOM
FrontRequestStartlong

The time when API Gateway started to receive the request.

1731487224968
FrontRequestEndlong

The time when API Gateway finished receiving the request.

1731487224968
BackendRequestStartlong

The time when API Gateway started to forward the request to the backend service.

1731487224969
BackendRequestEndlong

The time when API Gateway finished forwarding the request to the backend service.

1731487224969
BackendResponseStartlong

The time when API Gateway started to receive the response from the backend service.

1731487224989
BackendResponseEndlong

The time when API Gateway finished receiving the response from the backend service.

1731487224989
FrontResponseStartlong

The time when API Gateway started to forward the response to the client.

1731487224989
FrontResponseEndlong

The time when API Gateway finished forwarding the response to the client.

1731487224989

Examples

Sample success responses

JSONformat

{
  "RequestId": "CE5722A6-AE78-4741-A9B0-6C81********",
  "RequestLogs": {
    "RequestLog": [
      {
        "ApiId": "4b83229ebcab4ecd88956fb3********",
        "ApiName": "ApiName",
        "ConsumerAppKey": "20412****",
        "TotalLatency": 1345,
        "HttpMethod": "POST",
        "Domain": "360bdd88695c48ae8085c7f2********-ap-southeast-1.alicloudapi.com",
        "ErrorMessage": "Backend service connect failed `Timeout connecting to [/1XX.20.0.XX:8080]`",
        "ConsumerAppId": "11096****",
        "InstanceId": "apigateway-bj-ab2b********",
        "ClientNonce": "d43df9db-3b05-4cd6-888a-1c0b********",
        "RequestSize": 1923,
        "StageId": "8a305b7f10334052a52d9156********",
        "StageName": "RELEASE",
        "HttpPath": "/testPath",
        "RequestId": "95657ED9-2F6F-426F-BD99-79C8********",
        "GroupId": "dc024277fe6c4cada79ba0bd6********",
        "GroupName": "GroupName",
        "ErrorCode": "X500ER",
        "ResponseSize": 23441,
        "Region": "cn-hangzhou",
        "StatusCode": 200,
        "ClientIp": "21.237.XXX.XXX",
        "ServiceLatency": 324,
        "RequestTime": "2022-10-29T03:59:59Z",
        "Exception": "error msg",
        "CustomTraceId": "95657ED9-2F6F-426F-BD99-79C8********",
        "JwtClaims": {},
        "RequestProtocol": "HTTP",
        "RequestHeaders": "content-type: application/x-www-form-urlencoded",
        "RequestQueryString": "username=name",
        "RequestBody": "param=paramName",
        "ResponseHeaders": "content-type: application/x-www-form-urlencoded\n",
        "ResponseBody": "param=paramName\n",
        "plugin": [],
        "InitialRequestId": "95657ED9-2F6F-426F-BD99-79C8********",
        "AppName": "VIPROOM_VIPROOM",
        "FrontRequestStart": 1731487224968,
        "FrontRequestEnd": 1731487224968,
        "BackendRequestStart": 1731487224969,
        "BackendRequestEnd": 1731487224969,
        "BackendResponseStart": 1731487224989,
        "BackendResponseEnd": 1731487224989,
        "FrontResponseStart": 1731487224989,
        "FrontResponseEnd": 1731487224989
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-06The internal configuration of the API is changed, but the call is not affectedView Change Details