lnav logo

lnav

Terminal log file viewer that merges, formats, and indexes log files with SQL analysis and real-time monitoring

install

lnav is a terminal-based log file viewer that automatically detects log formats, decompresses files, and merges multiple log sources into a single chronological view. It can monitor directories for new files, follow file renames, and build indexes of errors and warnings for quick navigation. The tool handles various log formats including JSON lines and can pretty-print structured data.

The TUI interface provides spatial navigation with hotkeys to jump between errors (e/E), search with regular expressions (/), and filter messages using regex or SQLite expressions. Users can view message histograms over time (i), analyze logs with embedded SQLite queries (;), and highlight patterns with the :highlight command. The tool supports real-time tailing and can process compressed log files without manual decompression.

lnav integrates well with systemd-journald through piped input from journalctl, supporting both standard and JSON output formats. It recognizes additional fields like PRIORITY and _SYSTEMD_UNIT when using JSON format. The tool is particularly useful for system administrators, DevOps engineers, and developers who need to correlate events across multiple log sources and perform complex log analysis beyond basic grep and tail functionality.

Installation

# via Homebrew
brew install lnav
# via FreeBSD
pkg install lnav

lnav interface showing mixed syslog and web access logs

Alternatives & related tools

add a badge to your README

Maintain lnav? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/lnav.svg)](https://www.trmn.sh/tools/lnav?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/lnav?utm_source=badge"><img src="https://www.trmn.sh/badge/lnav.svg" alt="Featured on trmn" height="20"></a>