feat(runtime-logs): enhance auto-cleanup features and documentation
CI / changes (push) Successful in 9s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 33s
CI / go (push) Successful in 56s
CI / bird2 (push) Successful in 14s
CI / release (push) Successful in 20s

Added new endpoints for estimating and executing runtime log auto-cleanup based on tenant settings. Introduced configuration options for auto-cleanup policies, including scheduling and file size limits. Updated the API documentation and UI components to reflect these changes, improving user interaction with runtime log management. Enhanced error handling and added new UI elements for better visibility of audit logs and cleanup actions.
This commit is contained in:
Denozordec
2026-06-12 22:44:39 +07:00
parent f39df7c4bf
commit db75126bea
24 changed files with 1516 additions and 80 deletions
+122
View File
@@ -1168,6 +1168,54 @@ components:
has_more:
type: boolean
RuntimeLogAutoPolicy:
type: object
properties:
enabled:
type: boolean
max_file_bytes:
type: integer
format: int64
schedule:
type: string
description: UTC cron (minute hour dom month dow).
mode:
$ref: "#/components/schemas/RuntimeLogCleanupMode"
RuntimeLogAutoEstimateItem:
type: object
required: [filename, size_bytes, would_cleanup]
properties:
filename:
type: string
size_bytes:
type: integer
format: int64
would_cleanup:
type: boolean
skip_reason:
type: string
description: under_threshold, too_large, или текст ошибки.
RuntimeLogAutoEstimate:
type: object
properties:
policy:
$ref: "#/components/schemas/RuntimeLogAutoPolicy"
items:
type: array
items:
$ref: "#/components/schemas/RuntimeLogAutoEstimateItem"
would_count:
type: integer
minimum: 0
RuntimeLogAutoRunResult:
type: object
additionalProperties: true
description: |
dry_run, trigger, policy, cleaned[], skipped[], cleaned_count, skipped_count.
BirdLocalStatus:
type: object
description: Статус локального BIRD на хосте API (GET /v1/bird/status).
@@ -1388,6 +1436,23 @@ components:
bird_bgp_source_ipv6:
type: string
description: Зарезервировано; в текущей генерации BGP не используется.
revision_retention_minutes:
type: integer
minimum: 15
maximum: 43200
runtime_logs_auto_enabled:
type: boolean
description: Автоочистка *.log на evobgp-all по расписанию (только при FS volume).
runtime_logs_max_file_mb:
type: integer
minimum: 1
maximum: 512
description: Truncate/delete файлов строго больше порога (MiB).
runtime_logs_auto_schedule:
type: string
description: UTC cron для автоочистки (по умолчанию `0 */6 * * *`).
runtime_logs_auto_mode:
$ref: "#/components/schemas/RuntimeLogCleanupMode"
additionalProperties: true
RevisionDiff:
@@ -4116,6 +4181,63 @@ paths:
default:
$ref: "#/components/responses/DefaultProblem"
/v1/runtime-logs/auto-estimate:
get:
tags: [RuntimeLogs]
summary: Оценка автоочистки runtime log-файлов
description: |
Список файлов, которые будут затронуты текущей политикой tenant settings.
Требует evobgp-all с примонтированным каталогом runtime-logs.
operationId: estimateRuntimeLogAutoCleanup
parameters:
- $ref: "#/components/parameters/TenantId"
responses:
"200":
description: Успешно.
content:
application/json:
schema:
$ref: "#/components/schemas/RuntimeLogAutoEstimate"
"503":
description: FS API недоступен (не evobgp-all или нет volume).
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/runtime-logs/auto-run:
post:
tags: [RuntimeLogs]
summary: Запустить автоочистку runtime log-файлов
description: |
Немедленный прогон политики из tenant settings. `dry_run=true` — только оценка без FS-изменений.
Записи audit с `actor_prefix=auto:scheduler`.
operationId: runRuntimeLogAutoCleanup
parameters:
- $ref: "#/components/parameters/TenantId"
- name: dry_run
in: query
schema:
type: boolean
default: false
responses:
"200":
description: Успешно.
content:
application/json:
schema:
$ref: "#/components/schemas/RuntimeLogAutoRunResult"
"503":
description: FS API недоступен.
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/runtime-logs/cleanup-audit:
get:
tags: [RuntimeLogs]