Files
sencho/docs/features/global-observability.mdx
T
Anso a74a516850 fix(logs): harden global logs with shared parsing, SSE fixes, and level filter (#539)
- Extract log parsing utilities (normalizeContainerName, parseLogTimestamp,
  detectLogLevel, stripControlChars, demuxDockerLog) to shared module,
  eliminating duplication between polling and SSE endpoints
- Fix timestamp regex to accept timezone offsets (+HH:MM/-HH:MM), not just Z
- Replace any[] with typed GlobalLogEntry interface
- Add SSE heartbeat (30s) to prevent reverse proxy timeouts
- Add X-Accel-Buffering: no header for nginx SSE compatibility
- Replace swallowed catch blocks with console.warn diagnostics
- Fix SSE not reconnecting on node switch (missing dep in effect array)
- Add settings change event so devMode/pollRate updates apply without remount
- Add log level filter (ALL/ERROR/WARN/INFO) to toolbar
- Replace overflow-auto div with ScrollArea for design system compliance
- Add strokeWidth={1.5} to all toolbar icons
- Include stack name in download format
- Surface fetch errors with inline banner
- Add 39 unit tests for all log parsing utilities
- Update docs with level filter documentation and refreshed screenshot
2026-04-12 21:19:08 -04:00

72 lines
3.9 KiB
Plaintext

---
title: Global Observability
description: A unified, searchable log stream from every container across all your stacks.
---
The **Logs** tab aggregates output from all running containers into a single scrollable view. Instead of tailing logs one container at a time, you see everything in one place, with filtering to focus on what matters.
<Frame>
<img src="/images/global-observability/global-observability-overview.png" alt="Global Observability view showing real-time log lines from multiple containers" />
</Frame>
## Log format
Each line displays:
- **Timestamp** - when the log line was emitted (local time, 12-hour format)
- **Container name** - the specific container that produced the line, shown in brackets
- **Level** - `INFO`, `WARN`, or `ERROR` (where detectable), colour-coded for quick scanning
- **Message** - the raw log output, tinted red for `STDERR` lines
`WARN` lines appear in amber, `ERROR` lines in red, and `INFO` lines in green so you can spot problems at a glance.
## Streaming modes
Sencho supports two modes for fetching logs, controlled by the **Developer Mode** toggle in **Settings → Developer**:
| Mode | How it works | Best for |
|------|-------------|----------|
| **Standard** (default) | Polls all containers on a configurable interval | General use; lower overhead |
| **Developer mode** | Server-Sent Events (SSE) stream; logs arrive as they are emitted | Debugging; watching events in real time |
When Developer Mode is active, a pulsing green **● LIVE** indicator appears in the toolbar to confirm the SSE stream is connected.
The default polling interval is 5 seconds. You can change it to 1, 3, 5, or 10 seconds in **Settings → Developer → Standard Log Polling Rate**. This setting is disabled while Developer Mode is active because SSE streaming replaces polling entirely.
## Filtering logs
Use the controls in the toolbar above the log panel to narrow what you see:
| Control | What it does |
|---------|-------------|
| **Search** | Full-text filter across the message, container name, and stack name (case-insensitive) |
| **Stacks** | Checkbox dropdown; select one or more stacks to show only their containers' logs. Displays "All" when nothing is selected. |
| **All Streams** | Filter by output stream: `All Streams`, `STDOUT`, or `STDERR` |
| **All Levels** | Filter by severity: `All Levels`, `ERROR`, `WARN`, or `INFO` |
Filters combine. For example, you can show only `ERROR` lines from a specific stack while searching for a keyword.
## Controls
| Button | What it does |
|--------|-------------|
| **Clear** (trash icon) | Clears the current log buffer in the UI. Does not delete logs from Docker. |
| **Download** (download icon) | Exports the currently filtered logs as a `.txt` file. The filename includes a timestamp for easy identification. |
## Auto-scroll
The log view automatically scrolls to the bottom as new lines arrive. If you scroll up to inspect older entries, auto-scroll pauses so you are not pulled away. Scrolling back to the bottom re-enables it.
## Display limits
To keep the browser responsive, the log viewer enforces two capacity limits:
- **Memory buffer** - a maximum of 2,000 log entries are held in memory at a time. Older entries are dropped as new ones arrive.
- **Rendered rows** - only the most recent 300 entries from the filtered set are rendered as DOM nodes. If more entries match, a notice appears at the top of the log area showing how many entries exist versus how many are displayed.
For deeper investigation, use the [per-container log viewer](/features/editor#log-viewer) in the Editor tab, or `docker compose logs` directly from the [Host Console](/features/host-console).
<Note>
Log data retention on the backend is controlled by **Settings → Developer → Notification Log Retention** (default: 30 days). This affects historical notification and alert logs stored in Sencho's database, not the live container stream shown here.
</Note>