turnstone/patterns/watch.yaml
pyr0ball 0497d0ad60 feat: live watch mode — tail journald/docker/podman sources continuously (#4)
Adds background watcher that tails active log sources and ingests entries
in near-real-time, keeping the DB fresh without manual ingest runs.

- app/watch/watcher.py: Watcher + WatchSource using subprocess + select
  loop; flushes every 10s or 100 lines; syncs FTS index every 3 flushes
- patterns/watch.yaml: declarative source config (journald/docker/podman)
- app/rest.py: lifespan context manager starts/stops watcher on app
  startup/shutdown; GET /api/watch/status + POST /api/watch/reload
- web/src/views/DashboardView.vue: live/manual indicator chip + stale
  banner copy adapts to whether live watching is active
- tests/test_watch_watcher.py: 16 tests covering config load, command
  building, docker timestamp stripping, orchestrator lifecycle

Closes #4
2026-05-11 15:34:13 -07:00

35 lines
1.1 KiB
YAML

# Turnstone live watch sources — entries here are tailed continuously.
# The watcher starts automatically when Turnstone starts.
#
# Source types:
# journald — system journal via `journalctl -f -o json`
# docker — container logs via `docker logs -f --timestamps <container>`
# podman — container logs via `podman logs -f --timestamps <container>`
#
# For journald, optional args filter by unit:
# args: ["-u", "nginx", "-u", "sshd"]
#
# For docker/podman, args[0] is the container name (required).
#
# Leave this file empty (just the header) to disable live watching.
# Missing containers are skipped with a warning — safe to leave entries
# for services that are temporarily down.
sources: []
# ── Examples ────────────────────────────────────────────────────────────────
#
# - type: journald
# id: system-journal
#
# - type: journald
# id: sshd-journal
# args: ["-u", "sshd"]
#
# - type: podman
# id: podman:turnstone
# args: ["turnstone"]
#
# - type: docker
# id: docker:nginx
# args: ["nginx-proxy"]