tail-logs
v2.0.1
Published
Fast split-pane CLI log tailer for local files and Docker containers
Maintainers
Readme
tail-logs
A fast, single-binary split-pane CLI log tailer for local files and Docker containers — built for both humans (interactive new-tab TUI) and AI coding agents (bounded JSON queries + built-in MCP server).
Why tail-logs?
When debugging multi-service or Dockerized apps (like Laravel
microservices + workers + nginx), you usually end up opening 5
terminal tabs and manually typing docker exec ... tail -f ... over
and over.
With tail-logs, you define your project's log sources once in
.tail-log.json (or walk through the 10-second interactive setup
wizard), run tail-logs, and get:
- Automatic new terminal tab in Ghostty, iTerm2, Terminal.app,
WezTerm, Kitty, tmux, Windows Terminal, GNOME Terminal, and Konsole
(with automatic inline fallback in Warp, Alacritty, Cursor/VS Code,
etc.) that closes itself cleanly when you quit (
q). - Split-pane live tailing (vertical, horizontal, or auto-grid) with a global search bar that filters every pane at once.
- Pane-scoped character selection & double-click UUID copy — drag across a wrapped correlation ID or double-click it to copy only that exact string without bleeding into neighboring panes.
- Headless CLI & stdio MCP server so AI agents (Cursor, Claude Code, etc.) can triage errors, trace correlation IDs across containers, and capture bounded live logs without hanging.
Installation
tail-logs is a single native binary (written in Rust) with no runtime
dependencies. Prebuilt binaries are available for macOS (Apple
Silicon & Intel), Linux (x64 & arm64, statically linked), and Windows
(x64).
Homebrew (macOS & Linux):
brew install gwdhost/tap/tail-logsShell installer (macOS & Linux, installs to ~/.local/bin):
curl -fsSL https://github.com/gwdhost/tail-logs/releases/latest/download/tail-logs-installer.sh | shPowerShell installer (Windows):
irm https://github.com/gwdhost/tail-logs/releases/latest/download/tail-logs-installer.ps1 | iexSet TAIL_LOGS_INSTALL_DIR to change the install directory, or
TAIL_LOGS_VERSION=1.3.0 to pin a version.
npm / npx (downloads the matching native binary as an optional dependency; Node.js is only used to launch it):
npm install -g tail-logs
npx tail-logsCargo (build from source):
cargo install tail-logs --locked
# or the latest main branch:
cargo install --git https://github.com/gwdhost/tail-logs --lockedArchives and checksums for every platform are also attached to each GitHub Release.
Verify installation:
tail-logs --versionUpgrade to the latest version anytime:
tail-logs update # or: tail-logs upgrade
tail-logs update --check # check if a newer version is available without installingtail-logs update detects how it was installed (Homebrew, the
shell/PowerShell installer, npm/pnpm/yarn/bun, Cargo, or a git
checkout) and runs the matching upgrade command.
Quick Start
Navigate to any project directory and run:
tail-logs- If
.tail-log.jsonexists: opens a new terminal tab with a split pane for every configured log source. - If
.tail-log.jsondoes not exist: automatically launches the interactive setup wizard:- Auto-detects common local log files (
./storage/logs/*.log,./logs/*.log, etc.). - Lists all Docker containers (running first, fuzzy-filterable) and
lets you browse the container's folder tree starting from its
WORKDIR(e.g./var/www/html) with type-to-filter,Enterto descend/select,←/Backspaceto go up, and/to jump to a path. - Supports Docker container
stdout/stderr(docker logs -f) with no file path needed.
- Auto-detects common local log files (
Configuration File (.tail-log.json)
[
{
"type": "file",
"path": "./storage/logs/laravel.log"
},
{
"type": "docker",
"container": "auth-api",
"path": "/var/www/html/storage/logs/laravel.log"
},
{
"type": "docker-logs",
"container": "nginx",
"name": "nginx (stdout)"
}
]Optional fields on any entry:
"name": custom display label for the pane header."tailLines": initial number of lines to load on startup (default:200).
Live Config Reload:
.tail-log.jsonis watched while the viewer is running. Adding or removing sources in another terminal (e.g.tail-logs add) updates the open viewer automatically without losing existing buffers.
Interactive TUI Features
Inspector Modal (Pretty JSON + Stack Traces)
Multi-line stack traces (PHP/Laravel #0 ..., Node at ..., etc.)
are automatically grouped with their parent log entry and shown with a
compact [+N lines] badge. Press Enter on any line to open the
Inspector Modal with pretty-printed JSON and the full scrollable stack
trace, or press → in wrap mode on a multi-line entry to expand
it into a full-tab entry view (← or Esc to return):
Precision Copy & Selection
- Double-click any UUID / correlation ID / token — automatically highlights and copies the entire token (even if it wraps across two lines inside a narrow pane).
- Click & drag inside a pane — character-level selection clamped strictly to that pane (never bleeds into adjacent panes). Wrapped rows of the same log entry are joined without inserting bogus newlines, and releasing the mouse copies straight to your clipboard.
yor clickCopyin the pane header (orCmd+Cwhen CSI u is enabled in iTerm2) — copies the active character selection, or the full selected/bottom log entry.
Full-Tab Focus, Merged Timeline & Request Markers
- Full-Tab Mode (
f/zor clickFull) — expands the active session to fill the entire tab; pressEsc(or clickEsc: Split) to return to split view. - Merged Chronological Timeline (
M) — interleaves all log sources in time order with color-coded[source]tags so you can trace a single request across containers. - Request Marker (
m) — drops a bright────────── MARK HH:MM:SS ──────────divider across every pane right before you trigger an HTTP request or job (markers stay visible even with active filters). - Auto-Reconnect & Log Rotation — follows local files natively
(including rotation and truncation, on every OS) and automatically
reconnects with exponential backoff when a Docker container
restarts, showing live
● LIVE,⏸ PAUSED +N,↻ RECONNECT, or✕ STOPPEDbadges. - Persistent Preferences — line wrap (
W) and macOS desktop error notifications (o) are remembered across sessions in~/.config/tail-logs/prefs.json.
Keyboard & Mouse Shortcuts
| Action | Shortcut / Mouse |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Search & filter all panes (!term excludes) | / (type to filter, Ctrl+R regex, Ctrl+U clear, Esc done/clear) |
| Filter by log level | e (Errors), w (Warn+), i (Info+), a (All) |
| Switch active pane | Tab / Shift+Tab, 1–9, or click any pane |
| Scroll vertically | ↑/↓, j/k, PgUp/PgDn, Ctrl+U/Ctrl+D, or mouse wheel |
| Scroll sideways (when wrap is off) | ←/→ (Shift+←/→ fast), 0 to reset, or trackpad horizontal scroll |
| Toggle multi-line text wrap (saved) | W (Shift+W) |
| Jump to top / scroll to bottom | g (top), b / G / End (bottom & resume), B (all panes to bottom), or click ↓ Bottom |
| Pause / resume tail | Space or p (active pane), P (all panes) |
| Full-tab active session | f or z (or click Full), Esc to return to split view |
| Cycle split layout | l (Vertical / Horizontal / Grid) |
| Merged chronological timeline | M (Shift+M), Esc to return to split view |
| Insert request marker across all panes | m |
| Clear screen buffer (does not modify files) | c (active pane), C (all panes) |
| Jump to next / previous ERROR | n / N (or ] / [), x resets error counter |
| Inspect full entry (JSON & stack trace) | Enter (modal), or → in wrap mode for full-tab stack trace (←/Esc to return) |
| Copy UUID / text / full log line | Double-click token, drag to select, y, Cmd+C, or click Copy |
| Export filtered logs to .log file | s (active pane / merged), S (all panes) |
| Toggle macOS error notifications (saved) | o |
| Help overlay / Quit (auto-closes tab) | ? / q or Ctrl+C |
CLI Subcommands
Interactive Management
tail-logs # Open viewer in a new tab (runs setup if .tail-log.json is missing)
tail-logs --here # Open viewer in the current terminal tab
tail-logs init # Create or overwrite .tail-log.json interactively
tail-logs add # Add one or more log sources to .tail-log.json
tail-logs edit # Rename, reorder, or remove sources in .tail-log.json
tail-logs update # Upgrade to the latest version (alias: upgrade; supports --check, --force, --json)Headless & AI Agent Commands
All headless commands are non-interactive, bounded (never
hang), strip ANSI automatically when piped, and support --json /
--jsonl and --cwd <dir>.
# 1. Discover configured sources & check live file/container health
tail-logs sources --json
# 2. Low-token triage: error/warning counts & deduplicated top errors
tail-logs summary --json
tail-logs summary --since 10m --source app,auth-api --json
# 3. Read & filter logs (groups stack traces, supports !exclude & --merged)
tail-logs read --level error --lines 50 --json
tail-logs read --search "2a3aa080-ddff-4fe5-8cc8-a52f3d89ba53 !healthcheck" --merged --json
tail-logs read --since 5m --source auth-api --jsonl
# 4. Bounded live capture (captures only new lines arriving during the window)
tail-logs wait --duration 5s --level warn --json
tail-logs wait --until "OrderCreated|ERROR" --timeout 15s --jsonBuilt-in MCP Server (tail-logs mcp)
tail-logs includes a zero-dependency stdio MCP server exposing 4
structured tools:
get_sources— list.tail-log.jsonentries and live health statusget_log_summary— low-token error/warning triage with deduplicated top errorsread_logs— filtered, stack-trace-grouped log queries across files & Docker containerswait_for_logs— bounded live capture withduration,until, andtimeout
Add it to Cursor's .cursor/mcp.json:
{
"mcpServers": {
"tail-logs": {
"command": "tail-logs",
"args": ["mcp"]
}
}
}Development
Requires a stable Rust toolchain (1.91+, install via rustup).
cargo run -- --here # Run the viewer from source
cargo test # Unit tests + CLI/MCP integration tests
cargo clippy --all-targets # Lints
cargo fmt # Format
cargo build --release # Optimized binary in target/release/tail-logsnode bin/tail-logs.js runs the npm launcher against a local
target/release (or target/debug) build, or against any binary set
in TAIL_LOGS_BINARY.
Releasing
- Bump
versionin bothCargo.tomlandpackage.json(keepoptionalDependenciesin sync withnode scripts/npm-packages.mjs --sync-only). - Commit, then push a matching tag:
git tag v1.4.0 && git push --tags.
The Release workflow builds binaries for all five targets, creates
the GitHub Release (archives, checksums, installers), publishes the
@tail-logs/* platform packages and the tail-logs npm wrapper,
updates the gwdhost/homebrew-tap formula (needs
HOMEBREW_TAP_TOKEN), and publishes to crates.io (needs
CARGO_REGISTRY_TOKEN).
License
MIT
