itecdn 5.x / 用户 API
获取访问日志请求详情
GET
/v1/monitor/site/access-log/{id}按 Elasticsearch 文档 ID 获取访问日志的请求头、响应头和请求体。接口要求登录。普通用户仅能读取日志中 uid 与自身相同的记录;管理员可读取任何记录。当前服务端直接取查询结果首项,日志 ID 不存在时没有标准业务错误封装,可能返回服务端异常。
身份认证
access-token
api-key + api-secret
认证定义
{
"AccessToken": {
"type": "apiKey",
"in": "header",
"name": "access-token",
"description": "通过登录接口获得的短期访问令牌。"
},
"ApiKey": {
"type": "apiKey",
"in": "header",
"name": "api-key",
"description": "API Key;必须和 api-secret 同时发送。"
},
"ApiSecret": {
"type": "apiKey",
"in": "header",
"name": "api-secret",
"description": "API Secret;必须和 api-key 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
id | path | string | 必填 | 访问日志 Elasticsearch 文档 ID。 完整参数定义 |
响应
HTTP 200
成功和普通用户越权均使用 HTTP 200。缺失的 req_header、resp_header 或 req_body 统一返回空字符串。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 0 表示查询成功。 约束 / 默认值 / 示例 | ||||||||||||||||
msg | string | 必填 | 成功时固定为空字符串。 约束 / 默认值 / 示例 | ||||||||||||||||
data | object | 必填 | 指定访问日志记录中保存的原始请求与响应内容。 约束 / 默认值 / 示例展开字段结构指定访问日志记录中保存的原始请求与响应内容。
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 普通用户访问其他用户日志或认证失败时返回。 约束 / 默认值 / 示例 |
msg | string | 必填 | 权限不足或认证失败的具体原因。 |
data | string | 必填 | 业务错误时为空字符串。 约束 / 默认值 / 示例 |
完整 Schema
{
"oneOf": [
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "0 表示查询成功。"
},
"msg": {
"type": "string",
"enum": [
""
],
"description": "成功时固定为空字符串。"
},
"data": {
"type": "object",
"description": "指定访问日志记录中保存的原始请求与响应内容。",
"required": [
"req_header",
"resp_header",
"req_body"
],
"properties": {
"req_header": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
],
"description": "日志原始请求头;字段未记录时为空字符串。对象形式的键为 HTTP 头名称、值为对应头值。"
},
"resp_header": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
],
"description": "日志原始响应头;字段未记录时为空字符串。对象形式的键为 HTTP 头名称、值为对应头值。"
},
"req_body": {
"type": "string",
"description": "日志原始请求体;字段未记录时为空字符串。"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"access_log_detail-1",
"login_required"
],
"description": "普通用户访问其他用户日志或认证失败时返回。"
},
"msg": {
"type": "string",
"description": "权限不足或认证失败的具体原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "业务错误时为空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"msg": "",
"data": {
"req_header": {
"host": "www.example.invalid",
"user-agent": "curl/8"
},
"resp_header": {
"content-type": "text/html"
},
"req_body": ""
}
}查询成功
{
"code": 0,
"msg": "",
"data": {
"req_header": {
"host": "www.example.invalid",
"user-agent": "curl/8"
},
"resp_header": {
"content-type": "text/html"
},
"req_body": ""
}
}访问其他用户日志
{
"code": "access_log_detail-1",
"msg": "无权限",
"data": ""
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/monitor/site/access-log/{id}" \
--header "access-token: YOUR_ACCESS_TOKEN"