log-viewer

module
v0.0.0-...-6db6167 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: Apache-2.0

README

lv

CI Release Go Reference Go version Licence

A terminal log viewer for files bigger than your RAM, with vi's keys.

Open a 100 GB log on a machine with 10 GB and it starts instantly and stays small: memory depends on your terminal size, not on the file.

  • Huge files, flat memory. Indexing runs in the background; the first screen appears at once.
  • vi keys. j/k, /, n, gg/G, counts, visual mode — and every key can be rebound.
  • Filters that stack. Show only what matches, hide what doesn't, highlight the rest; save the set and reuse it on the next incident.
  • Knows log formats. Kernel, syslog, JSON and ISO-timestamped logs are recognised from their content and coloured; add your own in a few lines.
  • Follows and pages. tail -f for growing files and pipes, and a drop-in $PAGER for git log and friends.

Linux, macOS, FreeBSD, OpenBSD and Windows.

Install

go install github.com/sidcha/log-viewer/cmd/lv@latest

Or download a binary from the releases page, run it with nix run github:sidcha/log-viewer or add it to a Nix config (see Nix), or build from source with make build (see development).

Quick start

lv /var/log/syslog              # open a file
lv -f /var/log/kern.log         # follow it, like tail -f
journalctl -f | lv -f           # follow a pipe
git log | lv                    # use it as a pager
lv -o ERROR -N healthcheck app.log   # only ERROR lines, never healthcheck
lv -r incident.json app.log     # reuse rules saved earlier
lv -r api.rules api.log worker.log    # several files; ] and [ switch

Inside lv:

Key Does
j k gg G move down, up, to the top, to the end
C-d C-u Space half page down / up, page down
/ ? n N search forward, back, next, previous
f fuzzy-find a line and jump to it
& ! m show only / never show / highlight matching lines
= list, edit and toggle your rules
\ turn every rule off for a moment
F follow the end of the file
: command line (:42, :set wrap, :w out.log)
F1 help
q quit

These are defaults — see key bindings for the full map and how to change any of it.

Documentation

Licence

Apache-2.0. See LICENSE.

Directories

Path Synopsis
cmd
lv command
Command lv is a terminal log viewer for files that do not fit in memory.
Command lv is a terminal log viewer for files that do not fit in memory.
internal
ansi
Package ansi reads the terminal escape sequences a log may already carry.
Package ansi reads the terminal escape sequences a log may already carry.
atomicfile
Package atomicfile replaces a file's contents all at once or not at all.
Package atomicfile replaces a file's contents all at once or not at all.
checkpoint
Package checkpoint is the sparse position table behind every addressable sequence of lines.
Package checkpoint is the sparse position table behind every addressable sequence of lines.
clipboard
Package clipboard copies text to the system clipboard from a terminal.
Package clipboard copies text to the system clipboard from a terminal.
color
Package color is the one colour type lv computes with: rule colours, the terminal's own colours, and the tints derived from them.
Package color is the one colour type lv computes with: rule colours, the terminal's own colours, and the tints derived from them.
config
Package config parses lv's configuration: settings, key bindings, colour styles and syntax profiles.
Package config parses lv's configuration: settings, key bindings, colour styles and syntax profiles.
export
Package export writes the current view to a file.
Package export writes the current view to a file.
filter
Package filter decides which lines survive.
Package filter decides which lines survive.
highlight
Package highlight styles log lines.
Package highlight styles log lines.
index
Package index maintains a sparse map from line number to byte offset.
Package index maintains a sparse map from line number to byte offset.
lines
Package lines turns a byte source into lines without allocating per line.
Package lines turns a byte source into lines without allocating per line.
ruleset
Package ruleset reads and writes the rules a viewing session was built from.
Package ruleset reads and writes the rules a viewing session was built from.
source
Package source owns the bytes being viewed.
Package source owns the bytes being viewed.
termcolor
Package termcolor finds out what colours the terminal is actually using.
Package termcolor finds out what colours the terminal is actually using.
tty
Package tty reaches the controlling terminal directly.
Package tty reaches the controlling terminal directly.
ui
Package ui is the terminal front end: event loop, rendering, prompts.
Package ui is the terminal front end: event loop, rendering, prompts.
view
Package view turns the index and the filter rules into addressable sequences of lines that the UI can page through.
Package view turns the index and the filter rules into addressable sequences of lines that the UI can page through.
watch
Package watch reports when a file might have changed.
Package watch reports when a file might have changed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL