docs(runtime-logs): implement runtime log management features

Добавлены новые возможности для работы с файловыми логами Docker-сервисов:
- Эндпоинты для получения списка логов и хвоста лог-файла.
- Очистка лог-файлов с возможностью выбора режима (truncate или delete) и запись в аудит очистки.
- Обновлена документация и конфигурация для поддержки новых функций.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-06-12 19:04:53 +07:00
co-authored by Cursor
parent 1c39c65fc5
commit 3f0dd6c234
25 changed files with 1235 additions and 66 deletions
+15 -16
View File
@@ -3,29 +3,28 @@
## Текущий фокус
**Task:** `settings-ui-and-runtime-logs`
**Complexity:** Level 4
**Phase:** **CREATIVE complete****`/build`**
**Phase:** **BUILD Phase 2 complete****Phase 3** (HTTP handlers)
## Creative decisions (кратко)
## Phase 2 deliverables
| CP | Решение |
|----|---------|
| CP-1 | `/tenant-settings` + Tabs; mainNav «Параметры»; `/settings` = frontend |
| CP-2 | Monitoring tab `runtime-logs`; sub-tabs `files` / `audit` |
| CP-3 | Cleanup default `truncate`; max 512 MiB; tail 200 lines (max 2000), 256 KiB cap |
| CP-4 | Regex `^[a-z0-9][a-z0-9_.-]*\.log$` + EvalSymlinks + root prefix |
- `internal/runtimelogs/` — Config, Service, safe path, List/Tail/Cleanup
- `EVOBGP_RUNTIME_LOGS_DIR` в `internal/config/config.go`
- `docs/access.md` — документация env
## Коммиты creative (local, no push)
## Ключевые константы
1. `ceb6f2f` — CP-1 tenant settings UI
2. `e27936c` — CP-2 runtime logs UI
3. `493575a` — CP-3 cleanup & tail
4. (pending) — CP-4 path safety
- Guard: `EVOBGP_SERVICE=evobgp-all` + non-empty absolute `EVOBGP_RUNTIME_LOGS_DIR`
- Cleanup max: 512 MiB; tail: 200 default, 2000 max, 256 KiB read cap
## Тесты
- `go test ./internal/runtimelogs/...` — pass
- `scripts/lint-go.ps1` — pass
## Следующий шаг
```
/build Phase 1
/build Phase 3
```
OpenAPI + migration `000026` + store (см. `tasks.md`).
HTTP handlers + routes для `/v1/runtime-logs/*`.
+3 -11
View File
@@ -4,19 +4,11 @@
| Фаза | Статус |
|------|--------|
| VAN | ✅ |
| PLAN | ✅ |
| CREATIVE | ✅ (4/4 docs, 4 commits) |
| BUILD P1 OpenAPI+store | ⏳ |
| BUILD P2 FS layer | ⏳ |
| VAN / PLAN / CREATIVE | ✅ |
| BUILD P1 OpenAPI+store | ✅ |
| BUILD P2 FS layer | ✅ 2026-06-12 |
| BUILD P3 HTTP | ⏳ |
| BUILD P4 Deploy | ⏳ |
| BUILD P5 Tenant UI | ⏳ |
| BUILD P6 Runtime logs UI | ⏳ |
| BUILD P7 QA | ⏳ |
| REFLECT | ⏳ |
| ARCHIVE | ⏳ |
## Реализация
_Не начата._
+9 -7
View File
@@ -8,7 +8,7 @@
|------|----------|
| **Task ID** | `settings-ui-and-runtime-logs` |
| **Complexity** | **Level 4** |
| **Status** | **CREATIVE complete**`/build` |
| **Status** | **BUILD Phase 2 complete**Phase 3 |
| **Дата VAN** | 2026-06-12 |
| **Дата PLAN** | 2026-06-12 |
@@ -151,9 +151,9 @@ GET /v1/runtime-logs/cleanup-audit # cursor/limit, viewer+
| created_at | TIMESTAMPTZ | |
**Checklist Phase 1:**
- [ ] `npx @redocly/cli lint docs/openapi.yaml`
- [ ] `scripts/check-migrations-pair.sh`
- [ ] store interface + memory tests
- [x] `npx @redocly/cli lint docs/openapi.yaml`
- [x] миграции `000026` postgres + sqlite (пары up/down)
- [x] store interface + memory tests (`TestMemoryRuntimeLogCleanupAudit`)
---
@@ -180,8 +180,8 @@ GET /v1/runtime-logs/cleanup-audit # cursor/limit, viewer+
4. Return `200` + audit id + sizes
**Checklist Phase 2:**
- [ ] `go test ./internal/runtimelogs/... -race`
- [ ] path traversal tests (`../`, symlinks)
- [x] `go test ./internal/runtimelogs/... -count=1`
- [x] path traversal + symlink tests (`safe_test.go`)
---
@@ -341,7 +341,9 @@ graph TD
- [x] VAN
- [x] PLAN
- [x] CREATIVE (4 docs)
- [ ] BUILD Phase 17
- [x] BUILD Phase 1 (OpenAPI + migration + store)
- [x] BUILD Phase 2 (FS layer + config)
- [ ] BUILD Phase 37
- [ ] REFLECT
- [ ] ARCHIVE