HUB
Sign inSign up
lazyjournal logo

lifailon/lazyjournal

By lifailon

•Updated 2 days ago

A TUI and Web mode for reading logs from journalctl, file system, Docker, Podman and Kubernetes.

Image
Security
Developer tools
Monitoring & observability
1

10K+

lifailon/lazyjournal repository overview

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⁠.

⁠Features

  • Zero-config setup — one executable, no dependencies required.
  • Optional web interface when running in a Docker container.
  • Centralized search across all log sources with a single filter.
  • Streaming output of new events, similar to tail -f.
  • List of all systemd units (including disabled ones) with their current state.
  • All system and user journals via journalctl (the tool for reading journald⁠ logs).
  • List of system boots for kernel log output.
  • Audit rules from auditd, filterable by key and viewable in interpret format.
  • File system logs such as Apache, Nginx, syslog, messages, and other files in /var/log.
  • All log files used by running processes (file descriptors), as well as custom paths.
  • Archived logs rotated with gz, xz, and bz2, and Packet Capture files (pcap).
  • Apple System Logs (asl).
  • Windows Event Logs via PowerShell and wevtutil, as well as application logs from the Windows file system.
  • Docker and Swarm logs from the file system or stream, with built-in timestamps and stream filtering.
  • Logs from all containers in Docker Compose stacks, merged and sorted by time.
  • Podman logs without a running daemon or socket.
  • Kubernetes pod logs (requires a configured kubeconfig).
  • k3s pod and container logs from the file system on any node, including workers.
  • Search and analyze logs from remote hosts in a single interface using rsyslog⁠.
  • Remote access over SSH.
  • Switch Docker and Kubernetes contexts and namespaces in the interface.
⁠Filtering

Supports four filtering modes:

  • Exact (default) — an exact search for the specified substring, using the Contains method from the strings package.
  • Fuzzy (like AND in SQL) — searches for all specified words (separated by spaces) anywhere in a string.
  • Regex (like 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.
  • Date — filtering by date (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).

⁠Highlighting

The project features built-in log highlighting with several color groups:

  • Custom — URLs, HTTP request methods and response status codes, double quotes and braces for JSON, file paths, and processes on Unix-like systems.
  • Yellow — warnings and known names (host name and system users).
  • Green — keywords indicating success.
  • Red — keywords indicating errors.
  • Blue — statuses and actions (e.g. restart, update).
  • Light blue — numbers (date, time, timestamp, bytes, versions, percentage, integers, IP and MAC addresses).

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⁠).

⁠Installation

Prebuilt binaries are available on the GitHub releases⁠ page.

⁠Go

Install on any supported operating system (Linux, macOS, Windows, etc.) using the Go toolchain⁠:

go install github.com/Lifailon/[email protected]
⁠Unix-like

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.

⁠APT (Debian / Ubuntu)

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
⁠Homebrew (macOS / Linux)

Run the following command to install lazyjournal on macOS or Linux using Homebrew⁠:

brew install lazyjournal
⁠Conda (Cross-platform)

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
⁠Arch Linux

If you are an Arch Linux user, you can also install lazyjournal from the AUR⁠:

paru -S lazyjournal
⁠Temporary shell (Nix)

To run lazyjournal in a temporary environment without a permanent installation, install Nix⁠ and launch it from Nixpkgs⁠:

nix-shell -p lazyjournal
⁠Docker (Debian-based)

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.

⁠Web mode (ttyd)

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.

⁠Windows

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 Files
  • ProgramData
  • Windows\Logs
  • A custom path (defaults to the current user's home directory, which includes AppData, Documents, etc.)

Automatic detection of the following encodings is supported:

  • UTF-8
  • UTF-16 with BOM
  • UTF-16 without BOM
  • Windows-1251 (fallback encoding)

⁠Usage

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).

⁠Configuration

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:

  1. The current working directory from which the program was launched (highest priority)
  2. The directory containing the executable file
  3. /etc/lazyjournal/config.yml (added in issue #71⁠)
  4. ~/.config/lazyjournal/config.yml

Run lazyjournal -g to print the resolved configuration path and the active values.

⁠Remote mode (ssh)

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
⁠Command-line mode (cli)

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

⁠Build

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.

⁠Contributing

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.

  • If you would like to add a new feature, please first open an issue⁠ to discuss it.
  • If you have found a problem and are able to fix it yourself, please submit a Pull Request⁠.
  • Please do not report security vulnerabilities in public issues. See SECURITY.md⁠ for the private reporting process.

Thanks to everyone who contributed:

⁠Mentions

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.

⁠Alternatives

  • Lnav⁠ — The Logfile Navigator is a log file viewer for the terminal.
  • Toolong⁠ — A terminal application to view, tail, merge, and search log files.
  • Nerdlog⁠ — A remote, multi-host TUI syslog viewer with a timeline histogram and no central server.
  • Gonzo⁠ — A log analysis terminal UI with beautiful charts and AI-powered insights.
  • Dozzle⁠ — A small, lightweight application with a web-based interface for monitoring Docker logs.

⁠License

This project is licensed under the MIT License. See the LICENSE⁠ file for details.

Copyright (C) 2024 Lifailon (Alex Kup)

Tag summary
Recent tags
Content type
Image
Digest
sha256:409cc5228…
Size
86 MB
Last updated
2 days ago
docker pull lifailon/lazyjournal:latest