Skip to content
/ logtui Public

Keyboard-first TUI for streaming JSON logs with filtering, columns, and details.

License

Notifications You must be signed in to change notification settings

jnatten/logtui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪵 logtui

A fast, keyboard-driven TUI for exploring structured (JSON) logs from stdin or files. It shows a concise log list with selectable rows, a details pane for full JSON, live regex filtering, column toggling/reordering, and vi-like navigation—perfect for tailing services, piping from tools like stern, or inspecting static log files.

✨ Features

  • Streaming input: Read from stdin (pipes) or --file without buffering the world.
  • Pause/resume intake: Hit s to stop ingesting new lines; resume with s (discarded while paused).
  • Interactive list + details: Summaries on the left, full JSON on the right; zoom either pane with z.
  • Field viewer: Ctrl+T opens an explorer of every nested field; send a field value into the main / filter with /.
  • Regex filtering: Hit /, type a regex, Enter to apply; status bar shows active filter/errors.
  • Column control: Toggle and reorder columns (including dynamically discovered fields) via c; horizontal scroll with h/l, jump with 0/$.
  • Autoscroll toggle: a to stick to the tail or browse without losing your place.
  • Nested field fallback: Automatically picks timestamp/level/message from top-level or data.*.
  • Graceful for plain text: Non-JSON lines render as TEXT with the raw content.
  • Colorized levels & JSON: Levels are colored per severity; details JSON is syntax-highlighted.

🚀 Quick start

# Run with a file
logtui --file article-api.log

# Pipe logs from stdin
kubectl logs mypod | logtui

⌨️ Keys (essentials)

  • Help overlay: ?
  • Quit: q, Ctrl+C
  • Filter (regex): / (type, Enter to apply, Esc to cancel)
  • Zoom: z (zoom focused pane)
  • Redraw: Ctrl+L (clears stray artifacts)
  • Open in $EDITOR: e
  • Pause/resume intake: s (drops incoming lines while paused)

List pane

  • Move: j/k, Up/Down
  • Half page: Ctrl+d / Ctrl+u
  • Jump: g / G
  • Horizontal scroll: h / l; jump: 0 (start), $ (end)
  • Focus details: Enter, Tab, Right
  • Column selector: c
  • Toggle autoscroll: a

Detail pane

  • Scroll: j/k, Up/Down
  • Horizontal scroll (wrap off): h / l; jump: 0 (start), $ (end)
  • Half page: Ctrl+d / Ctrl+u
  • Jump: g / G
  • Back to list: Tab, Left, Esc
  • Column selector: c
  • Toggle wrap: w

Column selector (after c)

  • Move cursor: j/k, arrows
  • Toggle column: Space or Enter
  • Reorder: J (down), K (up)
  • Close: Esc

Field viewer (after Ctrl+T)

  • Filter fields: type to filter, Backspace to delete, Ctrl+u to clear
  • Move: j/k, Up/Down; half page: Ctrl+d / Ctrl+u
  • Horizontal scroll (wrap off): h / l; jump: 0 (start), $ (end)
  • Open in filter: / (prefills main / filter and returns)
  • Toggle wrap: w
  • Open selected in $EDITOR: Ctrl+E
  • Close: Esc, Ctrl+T
  • Note: s pauses intake globally (no new fields will arrive while paused).

🧠 Behavior notes

  • Dynamic columns: New fields discovered in logs (top-level and data.*) appear in the selector; defaults are timestamp, level, message (with message at the end).
  • Filtering: Applies to timestamp, level, message, and full JSON string. Invalid regex leaves the previous filter active and shows an error.
  • Nested fields: If timestamp/level/message are under data.*, they’re used automatically.
  • Paused intake: While paused (s), incoming lines are drained and dropped so the view stays stable; resume with s.

🛠️ Build & run

cargo check
cargo run -- --file logfile.txt
# or
cat logfile.txt | cargo run

🧭 Tips

  • Keep an eye on the status bar: it shows filter input/errors and column selector hints.
  • If the screen ever looks odd after a producer prints to stderr, Ctrl+L cleans it up.
  • Wide log records? Use h/l or 0/$ to pan horizontally; reorder columns to bring important fields forward.

Enjoy tailing! 🧭

About

Keyboard-first TUI for streaming JSON logs with filtering, columns, and details.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages