docs(runtime-logs): implement runtime log management features
Добавлены новые возможности для работы с файловыми логами Docker-сервисов: - Эндпоинты для получения списка логов и хвоста лог-файла. - Очистка лог-файлов с возможностью выбора режима (truncate или delete) и запись в аудит очистки. - Обновлена документация и конфигурация для поддержки новых функций. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -53,6 +53,11 @@ tags:
|
||||
description: Наблюдаемость PostgreSQL и корреляция (instance-level, viewer+). Maintenance — operator.
|
||||
- name: Maintenance
|
||||
description: Политики обслуживания PostgreSQL (instance-scoped). CRUD и запуск — operator.
|
||||
- name: RuntimeLogs
|
||||
description: |
|
||||
Файловые runtime-логи Docker-сервисов (каталог EVOBGP_RUNTIME_LOGS_DIR).
|
||||
Доступно только в процессе evobgp-all с примонтированным volume; иначе 503.
|
||||
Просмотр — viewer+; очистка — operator+ (синхронно, с audit).
|
||||
|
||||
security:
|
||||
- bearerAuth: []
|
||||
@@ -1060,6 +1065,109 @@ components:
|
||||
has_more:
|
||||
type: boolean
|
||||
|
||||
RuntimeLogCleanupMode:
|
||||
type: string
|
||||
enum: [truncate, delete]
|
||||
description: |
|
||||
truncate — обнулить файл (по умолчанию); delete — удалить файл с диска.
|
||||
|
||||
RuntimeLogFile:
|
||||
type: object
|
||||
required: [name, size_bytes, modified_at]
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: Basename файла (*.log) в каталоге runtime-логов.
|
||||
pattern: '^[a-z0-9][a-z0-9_.-]*\.log$'
|
||||
size_bytes:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
modified_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
RuntimeLogFileList:
|
||||
type: object
|
||||
required: [items]
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/RuntimeLogFile"
|
||||
|
||||
RuntimeLogTail:
|
||||
type: object
|
||||
required: [filename, content, truncated, lines_returned]
|
||||
properties:
|
||||
filename:
|
||||
type: string
|
||||
content:
|
||||
type: string
|
||||
description: UTF-8 текст хвоста файла.
|
||||
truncated:
|
||||
type: boolean
|
||||
description: true если применён лимит bytes/lines.
|
||||
lines_returned:
|
||||
type: integer
|
||||
minimum: 0
|
||||
|
||||
RuntimeLogCleanupResult:
|
||||
type: object
|
||||
required: [audit_id, filename, action, size_before]
|
||||
properties:
|
||||
audit_id:
|
||||
$ref: "#/components/schemas/ResourceId"
|
||||
filename:
|
||||
type: string
|
||||
action:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupMode"
|
||||
size_before:
|
||||
type: integer
|
||||
format: int64
|
||||
size_after:
|
||||
type: ["integer", "null"]
|
||||
format: int64
|
||||
|
||||
RuntimeLogCleanupAudit:
|
||||
type: object
|
||||
required: [id, tenant_id, actor_prefix, filename, action, size_before, created_at]
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/ResourceId"
|
||||
tenant_id:
|
||||
$ref: "#/components/schemas/ResourceId"
|
||||
actor_prefix:
|
||||
type: string
|
||||
filename:
|
||||
type: string
|
||||
action:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupMode"
|
||||
size_before:
|
||||
type: integer
|
||||
format: int64
|
||||
size_after:
|
||||
type: ["integer", "null"]
|
||||
format: int64
|
||||
detail:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
RuntimeLogCleanupAuditList:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupAudit"
|
||||
next_cursor:
|
||||
type: string
|
||||
has_more:
|
||||
type: boolean
|
||||
|
||||
BirdLocalStatus:
|
||||
type: object
|
||||
description: Статус локального BIRD на хосте API (GET /v1/bird/status).
|
||||
@@ -3761,6 +3869,148 @@ paths:
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/runtime-logs/files:
|
||||
get:
|
||||
tags: [RuntimeLogs]
|
||||
summary: Список runtime log-файлов
|
||||
description: |
|
||||
Список *.log в EVOBGP_RUNTIME_LOGS_DIR (размер и mtime).
|
||||
Требуется evobgp-all с примонтированным volume.
|
||||
operationId: listRuntimeLogFiles
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
responses:
|
||||
"200":
|
||||
description: Успешно.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuntimeLogFileList"
|
||||
"503":
|
||||
description: Runtime logs недоступны (не evobgp-all или каталог не настроен).
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Problem"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/runtime-logs/files/{filename}:
|
||||
get:
|
||||
tags: [RuntimeLogs]
|
||||
summary: Хвост runtime log-файла
|
||||
operationId: getRuntimeLogTail
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- name: filename
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-z0-9][a-z0-9_.-]*\.log$'
|
||||
description: Basename файла (без пути).
|
||||
- name: lines
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 2000
|
||||
default: 200
|
||||
- name: bytes
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 262144
|
||||
description: Альтернатива lines; при указании обоих — более строгий лимит.
|
||||
- name: grep
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
maxLength: 128
|
||||
description: Опциональный подстрочный фильтр (после чтения хвоста).
|
||||
responses:
|
||||
"200":
|
||||
description: Успешно.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuntimeLogTail"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
"503":
|
||||
description: Runtime logs недоступны.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Problem"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
delete:
|
||||
tags: [RuntimeLogs]
|
||||
summary: Очистить runtime log-файл
|
||||
description: |
|
||||
Синхронная очистка (truncate по умолчанию или delete). Запись в cleanup audit.
|
||||
Максимальный размер файла для очистки — 512 MiB. Только operator+.
|
||||
operationId: deleteRuntimeLogFile
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- name: filename
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-z0-9][a-z0-9_.-]*\.log$'
|
||||
- name: mode
|
||||
in: query
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupMode"
|
||||
description: По умолчанию truncate.
|
||||
responses:
|
||||
"200":
|
||||
description: Файл очищен.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupResult"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
"413":
|
||||
description: Файл превышает лимит 512 MiB.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Problem"
|
||||
"503":
|
||||
description: Runtime logs недоступны.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Problem"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/runtime-logs/cleanup-audit:
|
||||
get:
|
||||
tags: [RuntimeLogs]
|
||||
summary: Audit очистки runtime log-файлов
|
||||
operationId: listRuntimeLogCleanupAudit
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- $ref: "#/components/parameters/Cursor"
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
responses:
|
||||
"200":
|
||||
description: Успешно.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuntimeLogCleanupAuditList"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/settings:
|
||||
get:
|
||||
tags: [Settings]
|
||||
|
||||
Reference in New Issue
Block a user