feat(access-logs): 重构访问日志为概览与明细双 Tab

新增访问日志概览 API 与前端页面:汇总请求量/访问量/带宽趋势与 Top 排行,
明细列表保留检索;排行榜改为紧凑列表样式。
This commit is contained in:
ryan
2026-07-18 20:58:03 +08:00
parent 4c0c389122
commit 177578ef4e
24 changed files with 1546 additions and 1419 deletions
+4
View File
@@ -21,6 +21,10 @@ sidebar: false
## [unreleased]
### 变更
- 访问日志页面重构为「概览」与「日志明细」两个标签页:概览展示请求量、访问量、带宽趋势与 Top Paths/Hosts/IPs,明细列表保留检索能力;已移除时间折叠与 IP 汇总视图。
## [v3.4.0] - 2026-07-18
### 新增
+164
View File
@@ -5408,6 +5408,87 @@ const docTemplate = `{
}
}
},
"/api/v1/d/access-logs/overview": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "返回访问日志汇总指标、趋势与 Top 排行,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"openflare-observability"
],
"summary": "获取访问日志概览",
"parameters": [
{
"type": "string",
"description": "节点 ID",
"name": "node_id",
"in": "query"
},
{
"type": "string",
"description": "请求 Host",
"name": "host",
"in": "query"
},
{
"type": "integer",
"description": "统计时间范围(小时)",
"name": "hours",
"in": "query"
}
],
"responses": {
"200": {
"description": "访问日志概览",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/observability.AccessLogOverview"
}
}
}
]
}
},
"400": {
"description": "参数错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"404": {
"description": "无权限或不存在",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/d/acme-accounts/default": {
"get": {
"security": [
@@ -16148,6 +16229,89 @@ const docTemplate = `{
}
}
},
"observability.AccessLogOverview": {
"type": "object",
"properties": {
"generated_at": {
"type": "string"
},
"hours": {
"type": "integer"
},
"summary": {
"$ref": "#/definitions/observability.AccessLogOverviewSummary"
},
"top_hosts": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"top_ips": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"top_paths": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"trends": {
"$ref": "#/definitions/observability.AccessLogOverviewTrends"
}
}
},
"observability.AccessLogOverviewMetricPoint": {
"type": "object",
"properties": {
"bucket_started_at": {
"type": "string"
},
"value": {
"type": "integer"
}
}
},
"observability.AccessLogOverviewSummary": {
"type": "object",
"properties": {
"bandwidth_served": {
"type": "integer"
},
"total_requests": {
"type": "integer"
},
"total_visits": {
"type": "integer"
}
}
},
"observability.AccessLogOverviewTrends": {
"type": "object",
"properties": {
"bandwidth": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
},
"requests": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
},
"visits": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
}
}
},
"observability.AccessLogView": {
"type": "object",
"properties": {
+164
View File
@@ -5401,6 +5401,87 @@
}
}
},
"/api/v1/d/access-logs/overview": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "返回访问日志汇总指标、趋势与 Top 排行,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"openflare-observability"
],
"summary": "获取访问日志概览",
"parameters": [
{
"type": "string",
"description": "节点 ID",
"name": "node_id",
"in": "query"
},
{
"type": "string",
"description": "请求 Host",
"name": "host",
"in": "query"
},
{
"type": "integer",
"description": "统计时间范围(小时)",
"name": "hours",
"in": "query"
}
],
"responses": {
"200": {
"description": "访问日志概览",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/observability.AccessLogOverview"
}
}
}
]
}
},
"400": {
"description": "参数错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"404": {
"description": "无权限或不存在",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/d/acme-accounts/default": {
"get": {
"security": [
@@ -16141,6 +16222,89 @@
}
}
},
"observability.AccessLogOverview": {
"type": "object",
"properties": {
"generated_at": {
"type": "string"
},
"hours": {
"type": "integer"
},
"summary": {
"$ref": "#/definitions/observability.AccessLogOverviewSummary"
},
"top_hosts": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"top_ips": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"top_paths": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.DistributionItem"
}
},
"trends": {
"$ref": "#/definitions/observability.AccessLogOverviewTrends"
}
}
},
"observability.AccessLogOverviewMetricPoint": {
"type": "object",
"properties": {
"bucket_started_at": {
"type": "string"
},
"value": {
"type": "integer"
}
}
},
"observability.AccessLogOverviewSummary": {
"type": "object",
"properties": {
"bandwidth_served": {
"type": "integer"
},
"total_requests": {
"type": "integer"
},
"total_visits": {
"type": "integer"
}
}
},
"observability.AccessLogOverviewTrends": {
"type": "object",
"properties": {
"bandwidth": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
},
"requests": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
},
"visits": {
"type": "array",
"items": {
"$ref": "#/definitions/observability.AccessLogOverviewMetricPoint"
}
}
}
},
"observability.AccessLogView": {
"type": "object",
"properties": {
+103
View File
@@ -1937,6 +1937,60 @@ definitions:
total_record:
type: integer
type: object
observability.AccessLogOverview:
properties:
generated_at:
type: string
hours:
type: integer
summary:
$ref: '#/definitions/observability.AccessLogOverviewSummary'
top_hosts:
items:
$ref: '#/definitions/observability.DistributionItem'
type: array
top_ips:
items:
$ref: '#/definitions/observability.DistributionItem'
type: array
top_paths:
items:
$ref: '#/definitions/observability.DistributionItem'
type: array
trends:
$ref: '#/definitions/observability.AccessLogOverviewTrends'
type: object
observability.AccessLogOverviewMetricPoint:
properties:
bucket_started_at:
type: string
value:
type: integer
type: object
observability.AccessLogOverviewSummary:
properties:
bandwidth_served:
type: integer
total_requests:
type: integer
total_visits:
type: integer
type: object
observability.AccessLogOverviewTrends:
properties:
bandwidth:
items:
$ref: '#/definitions/observability.AccessLogOverviewMetricPoint'
type: array
requests:
items:
$ref: '#/definitions/observability.AccessLogOverviewMetricPoint'
type: array
visits:
items:
$ref: '#/definitions/observability.AccessLogOverviewMetricPoint'
type: array
type: object
observability.AccessLogView:
properties:
host:
@@ -7160,6 +7214,55 @@ paths:
summary: 获取访问日志 IP 趋势
tags:
- openflare-observability
/api/v1/d/access-logs/overview:
get:
description: 返回访问日志汇总指标、趋势与 Top 排行,需要管理员权限
parameters:
- description: 节点 ID
in: query
name: node_id
type: string
- description: 请求 Host
in: query
name: host
type: string
- description: 统计时间范围(小时)
in: query
name: hours
type: integer
produces:
- application/json
responses:
"200":
description: 访问日志概览
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/observability.AccessLogOverview'
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 无权限或不存在
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 获取访问日志概览
tags:
- openflare-observability
/api/v1/d/acme-accounts/default:
get:
description: 返回系统默认 ACME 账号配置,需要管理员权限