通过 API 返回的 Request ID 查询请求的日志详情,用于排查故障。
接口说明
通过 RAM 授权或角色扮演,支持跨 RAM 用户或跨阿里云账号之间查询调用日志。详见授权方式,请参见跨账号 API 错误诊断授权。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
openapiexplorer:GetRequestLog |
get |
*全部资源
|
无 | 无 |
请求语法
GET /getRequestLog HTTP/1.1
请求参数
名称 |
类型 |
必填 |
描述 |
示例值 |
logRequestId |
string |
是 |
需要查询日志的 RequestId, API 请求的唯一标识符(UUID 格式,且必须为大写)。 |
123E4567-E89B-12D3-A456-426614174000 |
返回参数
名称 |
类型 |
描述 |
示例值 |
object |
Schema of Response |
||
logInfo |
object |
包含 API 请求日志的详细信息。 |
|
basicInfo |
object |
包含 API 请求的基本信息。 |
|
api |
string |
所查询请求的 API 名称。 |
RunInstances |
apiDoc |
object |
API 文档信息。 |
|
aliyunSite |
string |
中国站文档链接。 |
https://api.aliyun.com/document/Ecs/2014-05-26/RunInstances |
alibabacloudSite |
string |
国际站文档链接。 |
https://api.alibabacloud.com/document/Ecs/2014-05-26/RunInstances |
apiVersion |
string |
API 版本信息。 |
2014-05-26 |
product |
string |
产品 CODE。 |
Ecs |
productName |
object |
产品名称信息,包含中文名和英文名。 |
|
cnName |
string |
产品中文名。 |
云服务器 ECS |
enName |
string |
产品英文名。 |
Elastic Compute Service |
apiStyle |
string |
API 风格,可能为 ROA 或 RPC 风格类型。 |
roa |
logRequestId |
string |
传入的 RequestId。 |
123E4567-E89B-12D3-A456-426614174000 |
httpStatusCode |
string |
所查日志内的 HTTP 状态码信息。 |
404 |
errorCode |
string |
所查日志内的错误码。如查询的请求并未报错,该字段为空。 |
IncorrectStatus.TransitRouter |
errorMessage |
string |
所查日志内的错误消息。如查询的请求并未报错,该字段为空。 |
The resource is not in a valid state for the operation. |
accessDeniedDetail |
object |
无权限报错详细信息。如查询的 RequestId 存在鉴权报错,则存在该字段,否则不存在该字段。 |
|
policyType |
string |
无权限的策略类型 |
AccountLevelIdentityBasedPolicy |
authPrincipalOwnerId |
string |
当前身份所属的阿里云账号 UID 信息 |
1001234561234567 |
authPrincipalType |
string |
操作者的身份类型 |
SubUser |
authPrincipalDisplayName |
string |
身份标识 |
205618123456123456 |
noPermissionType |
string |
无权限原因 |
ImplicitDeny |
authAction |
string |
导致无权限的具体操作 |
openapiexplorer:GetRequestLog |
encodedDiagnosticMessage |
string |
用于诊断的编码后信息。可调用 Ram 产品的 DecodeDiagnosticMessage OpenAPI 进一步诊断获得更多诊断信息。 |
- |
httpMethod |
string |
HTTP 请求方式。 例如 GET PUT POST 等 |
GET |
requestDuration |
string |
网关从收到请求到返回响应的时间。单位毫秒(ms)。 |
188 |
sdkRequestTime |
string |
发起请求时间。 日期格式按照 ISO8601 表示法,并使用 UTC 时间,格式为 yyyy-MM-ddTHH:mm:ssZ |
2025-01-21T07:43:06Z |
gatewayProcessTime |
string |
网关接收到请求的时间。 日期格式按照 ISO8601 表示法,并使用 UTC 时间,格式为 yyyy-MM-ddTHH:mm:ssZ |
2025-01-21T07:43:06Z |
regionId |
string |
服务区域 ID。 |
cn-hangzhou |
endpoint |
string |
服务区域对应的服务地址(Endpoint)。 |
ecs.cn-hangzhou.aliyuncs.com |
throttlingResult |
string |
流控校验结果。FC.PASS:未被流控检查拦截(未产生速率流控);FC.DENY:被流控检查拦截(发生速率流控)。 |
FC.PASS |
callerInfo |
object |
调用者信息。 |
|
callerType |
string |
调用者类型。
|
sub |
callerIp |
string |
调用者的 IP 地址 |
100.68.xxx.xxx |
masterAccountId |
string |
主账号 ID |
1973374733454118 |
callerAccountId |
string |
调用者账号 ID |
241009849925897811 |
userAgent |
string |
用户代理信息 |
AlibabaCloud API Workbench |
authenticationInfo |
object |
认证信息 |
|
signatureVersion |
string |
签名版本 |
unknown |
signatureMethod |
string |
签名方法。
|
HMAC-SHA256 |
authenticationType |
string |
认证类型。
|
AK |
parameters |
array<object> |
请求参数信息。 |
|
object |
|||
name |
string |
请求参数名。 |
InstanceType |
value |
any |
请求参数值。 |
ecs.g6.large |
required |
boolean |
该请求参数是否必填。 |
false |
type |
string |
该请求参数类型。 |
string |
responses |
object |
对应该请求的返回信息。 |
|
responseBody |
string |
返回信息。 |
- |
responseBodyFormat |
string |
响应体类型。 JSON、XML、HTML。 |
JSON |
requestId |
string |
本次请求 ID。 |
9BFC4AC1-6BE4-5405-BDEC-CA288D404812 |
示例
正常返回示例
JSON
格式
{
"logInfo": {
"basicInfo": {
"api": "RunInstances",
"apiDoc": {
"aliyunSite": "https://api.aliyun.com/document/Ecs/2014-05-26/RunInstances",
"alibabacloudSite": "https://api.alibabacloud.com/document/Ecs/2014-05-26/RunInstances"
},
"apiVersion": "2014-05-26",
"product": "Ecs",
"productName": {
"cnName": "云服务器 ECS",
"enName": "Elastic Compute Service"
},
"apiStyle": "roa",
"logRequestId": "123E4567-E89B-12D3-A456-426614174000",
"httpStatusCode": "404",
"errorCode": "IncorrectStatus.TransitRouter",
"errorMessage": "The resource is not in a valid state for the operation.",
"accessDeniedDetail": {
"policyType": "AccountLevelIdentityBasedPolicy",
"authPrincipalOwnerId": "1001234561234567",
"authPrincipalType": "SubUser",
"authPrincipalDisplayName": "205618123456123456",
"noPermissionType": "ImplicitDeny",
"authAction": "openapiexplorer:GetRequestLog",
"encodedDiagnosticMessage": "-"
},
"httpMethod": "GET",
"requestDuration": "188",
"sdkRequestTime": "2025-01-21T07:43:06Z",
"gatewayProcessTime": "2025-01-21T07:43:06Z",
"regionId": "cn-hangzhou",
"endpoint": "ecs.cn-hangzhou.aliyuncs.com",
"throttlingResult": "FC.PASS"
},
"callerInfo": {
"callerType": "sub",
"callerIp": "100.68.xxx.xxx",
"masterAccountId": "1973374733454118",
"callerAccountId": "241009849925897811",
"userAgent": "AlibabaCloud API Workbench"
},
"authenticationInfo": {
"signatureVersion": "unknown",
"signatureMethod": "HMAC-SHA256",
"authenticationType": "AK"
},
"parameters": [
{
"name": "InstanceType",
"value": "ecs.g6.large\n",
"required": false,
"type": "string"
}
],
"responses": {
"responseBody": "-",
"responseBodyFormat": "JSON"
}
},
"requestId": "9BFC4AC1-6BE4-5405-BDEC-CA288D404812"
}
错误码
HTTP status code |
错误码 |
错误信息 |
描述 |
---|---|---|---|
400 | InvalidParam.LogRequestId | Please ensure that the request ID you provided originates from a request you made to a certain OpenAPI. | 参数logRequestId无效。你请确保您提供的请求ID源自您向某个OpenAPI发出的请求。 |
404 | NotFound.RequestLog | The log related to this logRequestId does not exist, has expired, or you do not have permission to view it. | 与此logRequestId相关的日志不存在、已过期或您没有查看它的权限。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。