---
id: w3/m5/t003
title: Live tail decision + wiring — SSE on pod logs vs Loki tail
worker: worker3
status: todo
estimate: 25m
depends_on: [w3/m5/t002]
---

## Objective

Decide where the live tail (`FollowLogs`, the SSE endpoint the dashboard's live logs page consumes) reads from once Loki exists: keep following pod logs directly (real-time, zero new moving parts, but a freshly-restarted pod's tail starts empty) or switch to Loki's tail endpoint (single source for history+tail, small ingest lag). Pick one, implement, and record the decision + rationale in docs/ADR010-observability.md.

## Context

- `FollowLogs` / `PodLogsFollow` seam in `lego/backend/internal/logs/service.go`; SSE adapter shipped in w5/m6.
- Judge on: tail latency, behavior across pod restarts mid-tail, code complexity, failure modes when Loki is down (tail should degrade to pod logs, not die, if Loki is chosen).

## Steps

1. Try both against the mock cluster; measure tail lag and restart behavior.
2. Implement the winner behind the existing seam; keep the loser's path as the `BEX_LOKI_URL`-unset fallback.
3. Decision paragraph in docs/ADR010-observability.md.

## Files

- `lego/backend/internal/logs/`
- `docs/ADR010-observability.md`

## Acceptance criteria

- [ ] Live tail works with Loki deployed and degrades sanely when it isn't; the decision and its why are written down.

## Out of scope

- Dashboard changes (none — SSE contract unchanged).
