Logbuch – Log Viewer for VS Code
Open log files as a fast, filterable table: built-in and custom formats, live follow, logs merged by time, streams, exports and reports. Logbuch runs completely inside VS Code; nothing is uploaded.
Try the same viewer in the browser: https://armaxri.github.io/logbuch/
Getting started
- Open a
.log or .txt file and click Toggle Log View (list icon) in the editor title – or right-click a log in the Explorer → Logbuch → Open in Log View.
- Click a value to filter by it, type in the search box (
level:error -module:mqtt timeout), and press ? in the log for all shortcuts.
- Optional: run Logbuch: Use as Default Editor for .log Files. Reopen as Text in the editor title switches back at any time.
The walkthrough Get Started with Logbuch (Welcome page) shows these steps.
Features
- Formats out of the box: JSON Lines, logfmt, syslog, Apache/Nginx access logs, JVM, Python, Rust, klog, logcat and a generic format. Unknown logs get a format built from their lines.
- Filters that scale: facets with live counts, a query language, matches only, context lines, time ranges, saved views.
- Follow: growing files are followed (also on remote file systems);
.gz, .zip, .tar and rotated parts (app.log.1, app.log.2.gz) open directly.
- Several logs: merge logs by time or show them side by side with the time in sync.
- Live streams: WebSocket, Server-Sent Events, TCP or the output of a command (
$ journalctl -f, trusted workspaces only). The connection runs in the extension host; its status and line count are shown in the status bar.
- Export and reports: visible, selected or all lines as raw text, as shown (.tsv) or JSON, optionally redacted; Markdown or interactive HTML reports.
- Your configuration, shared: formats, columns, mappings, watches, charts and views live in
logbuch.config.json, with completion and hover help.
Large logs and the line limit
Logbuch keeps the newest maxLines lines in memory (default 200,000; set maxLines in logbuch.config.json). Local files above 64 MB are read as a stream and only their last maxLines lines are loaded; a message says how many earlier lines were not read.
Exports contain only the lines Logbuch holds. When lines were dropped by the limit, the export notification says how many are missing.
To keep every line of a live stream, use Logbuch: Record Stream to File… (record button in the editor title of a stream). Recording writes each new line to a file, independent of maxLines, until you click the REC entry in the status bar or close the stream.
Commands
Always available:
| Command |
What it does |
| Logbuch: Open in Log View |
Open the current file in Logbuch |
| Logbuch: Toggle Log View |
Switch the active editor between text and Logbuch (any text file, also unsaved buffers) |
| Logbuch: Open Log Files… |
Pick files (also archives); several files are merged by time |
| Logbuch: Connect to Stream… |
wss://…, https://… (SSE), host:port (TCP) or $ command |
| Logbuch: Open Logs Merged by Time… / Side by Side… |
Several logs in one view |
| Logbuch: Open Workspace Configuration |
Create or open logbuch.config.json |
| Logbuch: Use as Default Editor for .log Files / Stop Using as Default Editor |
Editor association for *.log and *.log.* |
While a log is open in Logbuch: Export…, Export Visible Lines…, Create Report…, Focus Search, Compare with File…, Next Error / Previous Error, Go to Line or Time…, Toggle Follow, Format Studio…, Reopen as Text, Open with Rotated Parts, Forget Remembered View State. For streams: Record Stream to File… and Stop Recording.
Keyboard
| Key |
Action |
Ctrl+F / ⌘F |
Focus search |
Ctrl+G (also on macOS, like Go to Line) |
Go to line or time |
F8 / ⇧F8 |
Next / previous error |
? |
All shortcuts of the viewer |
The keys only act while a Logbuch editor has the focus.
Settings
| Setting |
Default |
|
logbuch.details |
panel |
Line details in the bottom panel, below the table (editor) or off |
logbuch.follow |
true |
Follow growing files |
logbuch.timeZone |
(configuration) |
source, utc, local or an IANA zone like Europe/Berlin |
logbuch.config |
{} |
Configuration in the settings; logbuch.config.json is merged on top |
logbuch.streamReconnect |
true |
Reconnect network streams with a growing delay |
logbuch.commandRestart |
false |
Start a $ command stream again when it ended |
logbuch.notifyWatches |
false |
Notify for every watch hit in live logs |
logbuch.pollInterval |
2000 |
Poll interval (ms) for files on remote or virtual file systems |
Settings that depend on the log (config, follow, timeZone, …) can be set per folder in multi-root workspaces.
Configuration
logbuch.config.json in the workspace folder (or .vscode/logbuch.json) holds your formats, columns, mappings, watches, charts, state machines and views. Save to logbuch.config.json in the viewer writes items created in the UI there. See the configuration reference and the example workspaces.
Own storage formats plug in as decoders: "decoders": ["tools/my-decoder.mjs"] (paths relative to the workspace folder; only loaded in trusted workspaces and only from the configuration files, not from the setting).
Restricted Mode and remote workspaces
In Restricted Mode (untrusted folders) Logbuch shows logs, but does not load decoders from the workspace and does not run $ command streams; when you trust the folder, decoders are loaded right away. In virtual workspaces logs are shown and polled; decoders and command streams need a local or remote file system.
Links