itecdn 5.x / 用户 API
查询流服务端口流量排行
GET
/v1/monitor/stream/top聚合流访问日志,返回监听端口的请求数和发送流量排行。接口要求登录。普通用户仅查询自身 uid,管理员查询全部。榜单条数由系统 res_rank_size 配置决定;日志库无聚合或查询异常时返回空数组。
身份认证
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 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
type | query | string | 必填 | 排行维度,当前仅支持监听端口。 完整参数定义 |
recent_time | query | string | 必填 | 最近时间窗口,仅支持 10m、30m、60m。 完整参数定义 |
响应
HTTP 200
成功和业务错误均返回 HTTP 200。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 四层转发端口排行查询成功时固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||
msg | string | 必填 | 四层转发端口排行查询成功时固定为空字符串。 约束 / 默认值 / 示例 | ||||||||||||||||
data | array <object> | 必填 | 端口排行数据。 展开字段结构端口排行数据。 数组元素 · 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": "array",
"description": "端口排行数据。",
"items": {
"type": "object",
"required": [
"traffic",
"count",
"res"
],
"properties": {
"traffic": {
"type": "number",
"description": "该端口 bytes_sent 总和。"
},
"count": {
"type": "integer",
"minimum": 0,
"description": "该端口请求文档数。"
},
"res": {
"type": "string",
"description": "流日志字段 port 的聚合值。"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"stream_monitor_top-2",
"stream_monitor_top-3",
"stream_monitor_top-4",
"stream_monitor_top-5",
"login_required"
],
"description": "缺少/不支持类型、缺少/非法时间窗口或认证失败的业务错误码。"
},
"msg": {
"type": "string",
"description": "排行类型、时间窗口或认证失败的具体原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "发生业务错误时固定返回空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"msg": "",
"data": [
{
"traffic": 1048576,
"count": 42,
"res": "443/TCP"
}
]
}查询成功
{
"code": 0,
"msg": "",
"data": [
{
"traffic": 1048576,
"count": 42,
"res": "443/TCP"
}
]
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/monitor/stream/top" \
--header "access-token: YOUR_ACCESS_TOKEN"