lnav
$ lnav Community Low Risklnav automatically detects log formats (syslog, nginx, JSON-lines, compressed archives), merges entries chronologically, and exposes virtual SQLite tables. Passing -n runs lnav headlessly with -c SQL commands and :write-json-to - for structured JSON output.
brew install lnav Querying gigabytes of multi-format local logs via lnav -n SQLite queries avoids streaming raw log lines into MCP or LLM context.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Dedicated -n headless mode combined with -c SQLite queries and :write-json-to - provides surgical JSON/CSV filtering, though bare lnav enters a TUI.
- Supports
-nheadless execution and-ccommand pipelines - Emits JSON via
:write-json-to -over virtual SQLite log tables
Log analysis is read-only unless explicitly exporting to files (:write-*-to) or saving local session bookmarks.
- Never modifies source log files
Compiled C++ binary available via Homebrew, Linux distro repos, and static Linux releases; Windows requires WSL.
- macOS and Linux builds; no native Windows binary
Uniquely parses, decompresses, and joins heterogeneous logs into SQLite tables on the fly.
- Zero-ingestion SQLite querying across gz/bz2/json/syslog files
Actively maintained BSD-2-Clause project (tstack/lnav) with steady releases.
- Long-lived, actively developed GitHub repository
Extensive documentation at docs.lnav.org covering CLI flags, log formats, and SQL schema.
- Official ReadTheDocs manual and built-in SQL reference
Security, Auth & Guardrails
Operates on local log files by default; optional remote SFTP/SSH log tailing uses standard ~/.ssh/ config.
100% free, offline, and open-source (BSD-2-Clause).
# lnav Agent Rules - ALWAYS pass `-n` (headless mode) with `-c` commands; bare `lnav <file>` launches an interactive ncurses TUI that hangs non-TTY callers. - Prefer `:write-json-to -` with `LIMIT` clauses so huge log files do not flood stdout.
Agent-Ready Command Recipes
Safe Read-Only Queries
lnav -n -c ';SELECT log_time, log_level, log_body FROM all_logs WHERE log_level = "error" LIMIT 50' -c ':write-json-to -' app.log
Executes lnav headlessly (-n) and streams SQL-filtered error records to stdout as JSON via :write-json-to -.
lnav -n -c ';SELECT log_level, count(*) AS cnt FROM all_logs GROUP BY log_level' -c ':write-csv-to -' app.log
Aggregates log severity counts without loading raw log lines into agent context.
Strengths for Agents
- + Headless
-n+ SQLite queries +:write-json-to -turn messy logs into compact JSON answers. - + Decompresses
.gz/.bz2and merges multi-file timestamps automatically with zero setup.
Caveats & Pitfalls
- ! Running
lnavwithout-nopens an interactive ncurses UI that stalls headless agents. - ! No native Windows build outside WSL.