Skip to content
Projets

À propos

Blazingly fast TUI log viewer for multi-GB files, with bookmarks, cascading grep tabs and highlights.

Outils de développement

Comment ces chiffres sont mesurés

What you can do

  • Huge files. A multi-GB file opens at once and is indexed in the background - you can move through the lines indexed so far. Memory stays small, because the index stores a checkpoint every 1,000 lines (or 64 KiB), not the position of every line.
  • Vim motions. Move with j k gg G Ctrl-d Ctrl-u Ctrl-f Ctrl-b, add a count (20j, 500G), and scroll long lines sideways with h l 0.
  • Search. / and ? find a phrase, n and N jump between matches, and the status bar shows which match you're on ([3/41]).
  • Cascading grep tabs. Grep for ERROR to open a tab with only those lines, then grep that tab for user=42 to get [ERROR › user=42]. An inverted grep keeps the lines without a phrase, crossed out in the tab bar: [ERROR › user=42]. A tab fills while its grep runs, keeps its own cursor and search, and shows the file's original line numbers.

Progression mesurée des étoiles

in 24h
0
in 7 days
Historique en cours
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

therapist

CI crates.io License: MIT

Sometimes your system needs a little therapy, so here it is: a BLAZINGLY FAST terminal log viewer. Open multi-GB logs instantly and narrow them down with grep tabs, bookmarks and highlights. Just hope that after the session you're not the one who needs therapy.

therapist opening demo.log, grepping it for payments, searching for order_id=48225, grepping the tab again for that order, highlighting phrases and grepping out the lines with attempt=

Features

  • Huge files. A multi-GB file opens at once and is indexed in the background - you can move through the lines indexed so far. Memory stays small, because the index stores a checkpoint every 1,000 lines (or 64 KiB), not the position of every line.
  • Vim motions. Move with j k gg G Ctrl-d Ctrl-u Ctrl-f Ctrl-b, add a count (20j, 500G), and scroll long lines sideways with h l 0.
  • Search. / and ? find a phrase, n and N jump between matches, and the status bar shows which match you're on ([3/41]).
  • Cascading grep tabs. Grep for ERROR to open a tab with only those lines, then grep that tab for user=42 to get [ERROR › user=42]. An inverted grep keeps the lines without a phrase, crossed out in the tab bar: [ERROR › user=42]. A tab fills while its grep runs, keeps its own cursor and search, and shows the file's original line numbers.
  • Bookmarks. Bookmark a line, see the mark in every tab that shows that line, and jump from one bookmark to the next.
  • Highlights. Give phrases their own colors, shown in every tab. There are 12 colors, reused after that.

Installation

therapist runs on Linux and macOS. It needs Rust 1.91 or newer.

cargo install therapist

Or the latest from GitHub:

cargo install --git https://github.com/M-Komorek/therapist

Or from a clone:

git clone https://github.com/M-Komorek/therapist
cd therapist
cargo install --path .

Each way installs the command thr.

Usage

thr app.log

Press F1 in the app for the list of keys.

Key bindings

Moving needs no prefix. Changing something starts with Space:

  • Plain keys move: through lines, matches, bookmarks and tabs.
  • Space + a letter adds or removes one thing: a bookmark, a grep tab, a highlight.
  • Space + the capital letter removes all of them.

So Space b toggles one bookmark and Space B removes them all.

Key Action
Moving
j k Move the cursor down / up [count] lines
gg Go to the first line
G Go to the last line, or to line [count]
Ctrl+d Ctrl+u Scroll half a page down / up
Ctrl+f Ctrl+b Scroll a page down / up
Scrolling sideways
h l Scroll left / right [count] wide steps
0 Scroll back to the first column
Searching
/ ? Search forward / backward
n N Jump to the next / previous match
Esc Clear the search
Bookmarks
Space b Toggle the bookmark on the cursor line
Space B Remove all bookmarks
] [ Jump to the next / previous bookmark
Tabs
Space g Grep the active tab's lines into a new tab
Space v Grep lines without a phrase into a new tab
H L Switch to the previous / next tab
Space x Close the active tab
Space X Close every grep tab
Highlights
Space h Toggle the highlight of a phrase
Space H Remove all highlights
General
F1 Show the key help
Ctrl+z Suspend to the shell
q Quit

therapist's own log

therapist writes its own log to $XDG_STATE_HOME/therapist/therapist.log, which is ~/.local/state/therapist/therapist.log by default. Move it with --therapist-log PATH, and set the level with THERAPIST_LOG (default info):

THERAPIST_LOG=debug thr app.log

If the app crashes, it says where this log is.

This is fine 🧘

These were design decisions (for real, lol), and everyone is calm about it:

  • Search, grep and highlights match plain text, case-sensitively. No regular expressions: user=42 finds exactly user=42, and nothing else.
  • Bookmarks and highlights are gone when you quit. What happens in the session stays in the session.
  • therapist reads files, not pipes or stdin. Save the output first: kubectl logs my-pod > app.log.

Development

cargo run -- path/to/file.log

Before sending a change, run what CI runs:

cargo fmt
cargo clippy --all-targets -- -D warnings
cargo test
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps

License

MIT

Explorer des projets similaires

Chargement…