feat: live watch mode — tail journald/docker/podman continuously (#4) #16

Merged
pyr0ball merged 2 commits from feat/live-watch into main 2026-05-11 15:45:30 -07:00
Owner

Summary

  • Background Watcher class tails log sources via subprocess (journalctl -f, docker/podman logs -f), flushes to SQLite every 10s or 100 lines
  • patterns/watch.yaml declarative source config — add sources without restarting
  • FastAPI lifespan integration: watcher starts/stops cleanly with the server
  • GET /api/watch/status + POST /api/watch/reload endpoints
  • Dashboard shows live/manual indicator and adapts stale-data banner copy when watching is active
  • 16 tests: config loading, command building, Docker timestamp stripping, orchestrator lifecycle

Closes #4

Test Plan

  • pytest tests/ -v — 86 passing
  • Add a journald source to patterns/watch.yaml, restart server, verify entries appear in DB
  • Verify GET /turnstone/api/watch/status returns running sources
  • Verify dashboard shows live indicator when sources are active
## Summary - Background `Watcher` class tails log sources via subprocess (`journalctl -f`, `docker/podman logs -f`), flushes to SQLite every 10s or 100 lines - `patterns/watch.yaml` declarative source config — add sources without restarting - FastAPI lifespan integration: watcher starts/stops cleanly with the server - `GET /api/watch/status` + `POST /api/watch/reload` endpoints - Dashboard shows live/manual indicator and adapts stale-data banner copy when watching is active - 16 tests: config loading, command building, Docker timestamp stripping, orchestrator lifecycle Closes #4 ## Test Plan - [ ] `pytest tests/ -v` — 86 passing - [ ] Add a journald source to `patterns/watch.yaml`, restart server, verify entries appear in DB - [ ] Verify `GET /turnstone/api/watch/status` returns running sources - [ ] Verify dashboard shows live indicator when sources are active
pyr0ball added 1 commit 2026-05-11 15:35:28 -07:00
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
pyr0ball added 1 commit 2026-05-11 15:44:17 -07:00
- type: file uses tail -F (handles rotation) with auto-format detection
- _parse_lines dispatches to journald/servarr/qbit/caddy/syslog/plaintext
  based on first-line format detection — same logic as batch ingest
- watch.yaml updated with file type docs and xanderland-specific example
- scripts/journal-bridge.sh + .service written directly to xanderland

Xander's watch.yaml covers: system-journal-live (via bridge file),
sonarr, radarr, lidarr, prowlarr, bazarr, qbittorrent, nzbget, tautulli
pyr0ball merged commit 04801b62f4 into main 2026-05-11 15:45:30 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/turnstone#16
No description provided.