获取指定SQL语句的详细信息
功能介绍
获取指定SQL语句的详细信息
URI
GET /v2/{project_id}/audit/{instance_id}/sqls/{id}
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
参数解释: 项目ID。可通过IAM服务[查询指定IAM用户的项目列表]接口获取。 约束限制: 不涉及 取值范围: 以IAM服务接口返回值为准,字符长度32-64。 默认取值: 不涉及 |
|
instance_id |
是 |
String |
参数解释: 实例ID。可通过查询实例列表接口ID字段获取 约束限制: 不涉及 取值范围: 以查询实例列表接口值为准,字符长度32-64。 默认取值: 不涉及 |
|
id |
是 |
String |
参数解释: SQL语句ID。可在SQL列表查询接口ID字段获取。 约束限制: 不涉及 取值范围: 以SQL列表查询接口获取值为准。 默认取值: 不涉及 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务查询用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 不涉及 取值范围: IAM服务查询用户Token接口为准 默认取值: 不涉及 |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
sql |
SqlDetailBean object |
SQL语句对象 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
audit_result |
String |
审计结果 |
|
client_port |
Integer |
客户端端口 |
|
client_ip |
String |
客户端IP |
|
client_mac |
String |
客户端MAC地址 |
|
client_name |
String |
客户端名称 |
|
client_os_name |
String |
客户端系统主机名称 |
|
client_os_user |
String |
客户端操作系统用户名 |
|
client_port_str |
String |
客户端端口字符 |
|
client_tool |
String |
客户端连接工具 |
|
db_port |
Integer |
数据库端口 |
|
db_instance |
String |
数据库实例 |
|
db_ip |
String |
数据库IP |
|
db_mac |
String |
数据库MAC地址 |
|
db_port_str |
String |
数据库端口字符 |
|
db_service_name |
String |
数据库服务名称 |
|
db_session_id |
String |
数据库连接ID |
|
db_type |
String |
数据库类型 |
|
db_user |
String |
数据库用户 |
|
end_time |
String |
请求结束时间 |
|
execute_time |
Long |
执行时长 |
|
field |
String |
操作对象类型信息 |
|
id |
String |
记录ID |
|
level |
String |
风险等级
|
|
lines |
String |
影响行数 |
|
log_result |
String |
登入登出结果 |
|
object |
String |
操作对象 |
|
object_type |
String |
操作对象类型 |
|
query_id |
String |
查询ID |
|
query_type |
String |
操作类型 |
|
response_length |
Integer |
数据长度 |
|
response_status |
String |
响应状态 |
|
rule_id |
String |
规则ID |
|
rule_name |
String |
规则名称 |
|
rule_type |
String |
规则类型 |
|
schema |
String |
数据库SCHEMA |
|
scope_id |
String |
审计范围ID |
|
scope_name |
String |
审计范围名称 |
|
sql_response |
String |
SQL返回结果 |
|
sql_result |
String |
SQL处理结果 |
|
sql_statement |
String |
SQL语句内容 |
|
start_time |
String |
请求开始时间 |
|
tcp_session_id |
String |
TCP连接ID |
状态码:400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
details |
Array of DbssErrorDetail objects |
PDP5鉴权异常信息 |
|
encoded_authorization_message |
String |
PDP5鉴权异常信息 |
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
状态码:401
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
details |
Array of DbssErrorDetail objects |
PDP5鉴权异常信息 |
|
encoded_authorization_message |
String |
PDP5鉴权异常信息 |
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
状态码:403
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
details |
Array of DbssErrorDetail objects |
PDP5鉴权异常信息 |
|
encoded_authorization_message |
String |
PDP5鉴权异常信息 |
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
状态码:500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
details |
Array of DbssErrorDetail objects |
PDP5鉴权异常信息 |
|
encoded_authorization_message |
String |
PDP5鉴权异常信息 |
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
请求示例
/v1/{project_id}/audit/{instance_id}/sqls/{id}
响应示例
状态码:200
OK
{
"sql" : {
"id" : "J8Zcg5gBPj4d6CRtK3Y4",
"schema" : "",
"object" : null,
"field" : null,
"lines" : "1",
"level" : "",
"query_id" : "16d3aeff-c11c-4d22-8e60-d943b9f55dc5",
"tcp_session_id" : "10374",
"db_session_id" : "10374",
"db_user" : "root",
"db_type" : "MySQL5.7.44-241205",
"db_service_name" : "",
"db_instance" : "",
"db_ip" : "10.0.0.37",
"db_port" : 3306,
"db_port_str" : "3306",
"db_mac" : "",
"client_name" : "",
"client_ip" : "100.79.0.247",
"client_port" : 0,
"client_port_str" : "--",
"client_mac" : "",
"client_tool" : "",
"client_os_name" : "",
"client_os_user" : "",
"sql_statement" : "SELECT @@session.transaction_isolation",
"query_type" : "SELECT",
"object_type" : "VARIABLE",
"sql_result" : "SUCCESS",
"sql_response" : null,
"log_result" : "",
"response_status" : "EXECUT_SUCCESS",
"response_length" : 0,
"start_time" : "2025-08-07 06:57:43",
"end_time" : "2025-08-07 06:57:43",
"audit_result" : "SUCCESS",
"scope_id" : "tcg7LJgBTpKZyZbbeDjk",
"scope_name" : "FULL_AUDIT_RULES",
"rule_type" : "",
"rule_id" : "",
"rule_name" : "",
"execute_time" : 0
}
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
|
400 |
请求参数有误。 |
|
401 |
认证失败 |
|
403 |
未授权 |
|
500 |
服务端错误 |
错误码
请参见错误码。