A TUI and Web mode for reading logs from journalctl, file system, Docker, Podman and Kubernetes.
10K+
Terminal user interface for searching and viewing logs from journald, auditd, the file system, Docker and Podman containers, Compose stacks, and Kubernetes pods. It supports log highlighting and several filtering modes.
Written in Go with the awesome-gocui library (a fork of gocui). Inspired by lazydocker and lazygit.
tail -f.systemd units (including disabled ones) with their current state.journalctl (the tool for reading journald logs).auditd, filterable by key and viewable in interpret format.syslog, messages, and other files in /var/log.gz, xz, and bz2, and Packet Capture files (pcap).asl).wevtutil, as well as application logs from the Windows file system.kubeconfig).k3s pod and container logs from the file system on any node, including workers.Supports four filtering modes:
Contains method from the strings package.AND in SQL) — searches for all specified words (separated by spaces) anywhere in a string.grep) — search with support for regular expressions, based on the built-in regexp library. If the regular expression has a syntax error, the input field is highlighted in red.since and/or until) for journald logs, as well as Docker and Podman containers (streaming mode only), using the left and right arrow keys. This mode can be combined with other filtering modes and can improve loading performance for large logs. Change the UTC offset with the -T/--timezone-filter flag or the timezoneFilter configuration parameter (default: +00:00). Press delete (default) to disable date-based filtering. The current filter mode is displayed at the bottom of the interface.In all filtering modes, a global ignore-case search can be enabled with Ctrl+I. In addition to text-based filtering, journald logs can be filtered by priority (Ctrl+P, -J/--journal-priority, or journalPriority) and by system boot period (Ctrl+B, -b/--journal-boot, or journalBootPeriod).
The project features built-in log highlighting with several color groups:
A full list of keywords can be found in the color.log file (used for testing only).
You can disable highlighting with Ctrl+W. This is useful when the terminal already provides built-in highlighting (for example, WindTerm).
Prebuilt binaries are available on the GitHub releases page.
Install on any supported operating system (Linux, macOS, Windows, etc.) using the Go toolchain:
go install github.com/Lifailon/[email protected]
Install or update to the latest release on Linux, macOS, or a BSD-based system:
curl -sSL https://raw.githubusercontent.com/Lifailon/lazyjournal/main/scripts/install.sh | bash
This command runs a script that downloads the latest binary for your operating system and architecture from the GitHub releases page into the current user's home directory, placing it in ~/.local/bin/lazyjournal (the default location for user executables), downloads the default configuration file to ~/.config/lazyjournal/config.yml, and grants execute permissions to the binary.
The lazyjournal package is now officially available in the Debian repositories (testing and unstable), so install it with:
sudo apt update && sudo apt install lazyjournal
lazyjournal -h
lazyjournal
Or download the deb package from the GitHub releases page for installation on any Debian-based system, while lazyjournal gradually makes its way into the distribution repositories.
curl -sSL https://github.com/Lifailon/lazyjournal/releases/download/0.8.8/lazyjournal-0.8.8-$(dpkg --print-architecture).deb -o ./lazyjournal.deb
sudo apt install -y ./lazyjournal.deb && rm ./lazyjournal.deb
Run the following command to install lazyjournal on macOS or Linux using Homebrew:
brew install lazyjournal
If you use package managers like Conda or Mamba, install lazyjournal from conda-forge:
conda install -c conda-forge lazyjournal
mamba install -c conda-forge lazyjournal
You can also install lazyjournal user-globally using Pixi:
pixi global install lazyjournal
If you are an Arch Linux user, you can also install lazyjournal from the AUR:
paru -S lazyjournal
To run lazyjournal in a temporary environment without a permanent installation, install Nix and launch it from Nixpkgs:
nix-shell -p lazyjournal
Download the compose file and run the container using the image from Docker Hub:
mkdir lazyjournal && cd lazyjournal
curl -sSL https://raw.githubusercontent.com/Lifailon/lazyjournal/refs/heads/main/docker/debian/docker-compose.yml -o docker-compose.yml
# Run container with auto-remove on exit
docker compose run --rm lazyjournal --version
docker compose run --rm lazyjournal
# Or attach to the always-running service
docker compose up -d
docker attach lazyjournal
The image comes with the packages required by the application pre-installed. Read-only access to the host log sources is pre-configured in the compose file.
To access Kubernetes logs, forward your configuration into the container. If you use a local cluster (e.g. k3s), change the cluster server address in the configuration to the host's address on the local network.
The Debian-based image includes ttyd for browser access. Enable it with the following environment variables (see docker-compose.override.yml for a ready-to-use example):
# Enable web mode
TTYD=true
PORT=5555
# Theme and font size (default values)
BACKGROUND=#1e1e2e
FOREGROUND=#cdd6f4
FONT_SIZE=14
# Credentials for basic authentication (optional)
USERNAME=admin
PASSWORD=admin
# Enable SSL (certificates must be mounted into the container, e.g. ./certs:/certs)
CERT=/certs/lazyjournal.crt
KEY=/certs/lazyjournal.key
Mouse control is supported by default (it can be disabled with -m or in the configuration) for selecting windows and log entries from a list, as well as for scrolling lists and logs.
Install in your PowerShell console:
irm https://raw.githubusercontent.com/Lifailon/lazyjournal/main/scripts/install.ps1 | iex
The following directories are used to search for logs in the file system:
Program FilesProgramDataWindows\LogsAppData, Documents, etc.)Automatic detection of the following encodings is supported:
UTF-8UTF-16 with BOMUTF-16 without BOMWindows-1251 (fallback encoding)lazyjournal is a log viewer, not a log collector. To access logs, the corresponding tools must already be installed: docker-cli, docker-compose, podman, and kubectl.
Run the interface:
lazyjournal
Show all available flags:
lazyjournal -h
Access to system and container logs may require elevated privileges. For example, without read permission on /var/lib/docker/containers, a user can only read logs from the moment the container runtime started, not the archived logs from container creation. However, streaming mode is faster than parsing JSON log files from the file system.
To copy text, hold Alt+Shift while selecting, or press Shift+C to copy the visible text from the log window to the clipboard via OSC 52 (if supported by your terminal).
For debugging, pass the -l/--logging flag at startup to log executed commands to lazyjournal.log (every command and its flags are recorded, so you can verify them manually in the console).
Hotkeys, interface settings, and flag defaults can be overridden in the config.yml file (see issues #23, #27, and #37). The configuration file can be located in:
/etc/lazyjournal/config.yml (added in issue #71)~/.config/lazyjournal/config.ymlRun lazyjournal -g to print the resolved configuration path and the active values.
Access logs on a remote system by passing standard ssh options as a single quoted argument:
lazyjournal --ssh "[email protected]"
# Passing arguments
lazyjournal --ssh "[email protected] -p 2121 -o Compression=yes"
# If sudo is supported without a password prompt
lazyjournal --ssh "[email protected] sudo"
You can also list hosts in the configuration and switch between them in the interface with F2:
ssh:
hosts:
- [email protected]
- [email protected] -p 2121 -o Compression=yes
- [email protected] -o StrictHostKeyChecking=no -o ConnectTimeout=5
Warning
SSH-key authentication is recommended because every remote action would otherwise prompt for a password.
However, password-based access is possible by configuring connection reuse for a long period of time in ~/.ssh/config file:
Host *
# Keep the connection open for 1 hour
ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p
ControlPersist 1h
# Avoid errors when connecting to a host for the first time
StrictHostKeyChecking no
Highlighting and filtering are supported in command-line mode with piped input:
# Add an alias to your shell profile (optional)
echo "alias lj=lazyjournal" >> "$HOME/.bashrc" && source "$HOME/.bashrc"
# Highlight output from standard input
cat /var/log/syslog | lj -c
# Exact search mode
cat /var/log/syslog | lj -e "error"
# Fuzzy search mode
cat /var/log/syslog | lj -f "error docker"
# Regular expression (regex) mode
cat /var/log/syslog | lj -r "error|fail|fatal"
# Highlighting and ignore-case search are supported with any filtering mode
cat /var/log/syslog | lj -r "error|fail|fatal" -c -i
Clone the repository and use Go 1.27 or newer to build the binary:
git clone https://github.com/Lifailon/lazyjournal
cd lazyjournal
go build .
Note
Builds and tests is automated using GitHub Actions. A detailed coverage report for Linux, macOS, and Windows is available on the [Wiki](https://github.com/Lifailon/lazyjournal/wiki) page.
Since this is my first Go project, there may be some bad practices, BUT I want to make lazyjournal better, and any contribution is appreciated.
Thanks to everyone who contributed:
Spreading the word about the project is the best way to contribute to its development, as it can attract users with new ideas as well as other developers. If you have shared the project on social media, you can mention it in an issue or add a link to the post via a PR.
Mentions of the project on social media:
The project is also included in lists of awesome tools:
Please take a look at the other useful projects in these repositories.
This project is licensed under the MIT License. See the LICENSE file for details.
Copyright (C) 2024 Lifailon (Alex Kup)
docker pull lifailon/lazyjournal:latest