https://github.com/lifailon/lazyjournal
A TUI for reading logs from journald, auditd, file system, Docker containers, Podman and Kubernetes pods for quick viewing, coloring output and filtering with fuzzy find, regex support and timestamp.
https://github.com/lifailon/lazyjournal
audit-log auditd bsd docker-logs go gocui journal journalctl journald kubernetes-logging log-analysis log-monitor log-parser log-viewer logging logs podman regexp syslog tui
Last synced: 8 days ago
JSON representation
A TUI for reading logs from journald, auditd, file system, Docker containers, Podman and Kubernetes pods for quick viewing, coloring output and filtering with fuzzy find, regex support and timestamp.
- Host: GitHub
- URL: https://github.com/lifailon/lazyjournal
- Owner: Lifailon
- License: mit
- Created: 2024-11-12T07:54:04.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-19T12:40:51.000Z (about 1 month ago)
- Last Synced: 2025-05-15T12:06:28.539Z (8 days ago)
- Topics: audit-log, auditd, bsd, docker-logs, go, gocui, journal, journalctl, journald, kubernetes-logging, log-analysis, log-monitor, log-parser, log-viewer, logging, logs, podman, regexp, syslog, tui
- Language: Go
- Homepage: https://pkg.go.dev/github.com/Lifailon/lazyjournal
- Size: 17.9 MB
- Stars: 529
- Watchers: 5
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Terminal user interface for reading logs from `journalctl`, file system, Docker and Podman containers, as well Kubernetes pods for quick viewing and filtering with fuzzy find, regex support and coloring the output, written in Go with the [awesome-gocui](https://github.com/awesome-gocui/gocui) (fork [gocui](https://github.com/jroimartin/gocui)) library.
This tool is inspired by and with love for [LazyDocker](https://github.com/jesseduffield/lazydocker) and [LazyGit](https://github.com/jesseduffield/lazygit). It is also included in [Awesome-Go](https://github.com/avelino/awesome-go?tab=readme-ov-file#logging), [Awesome-TUIs](https://github.com/rothgar/awesome-tuis?tab=readme-ov-file#development) and [Awesome-Docker](https://github.com/veggiemonk/awesome-docker?tab=readme-ov-file#terminal-ui), check out other useful projects on the repository pages.

## Features
- Simple installation, to run download one executable file without dependencies and settings.
- Centralized search for the required journal by filtering all lists (log sources).
- Streaming output of new events from the selected journal (like `tail`).
- List of all units (`services`, `sockets`, etc.) with current running status from `systemd` via `systemctl`.
- View all system and user journals via `journalctl` (tool for reading logs from [journald](https://github.com/systemd/systemd/tree/main/src/journal)).
- List of all system boots for kernel log output.
- File system logs such as for `Apache` or `Nginx`, as well as `syslog`, `messages`, etc. from `/var/log`.
- Lists all log files in users home directories, as well as descriptor log files used by processes.
- Reading archive logs truncated during rotation (`gz`, `xz` and `bz2` formats), Packet Capture (`pcap` format) and Apple System Log (`asl` format).
- Docker containers (including `timestamp` and `stderr`), Podman pods and the Docker Swarm services.
- Kubernetes pods via `kubectl`.
- Windows Event Logs via `PowerShell` and `wevtutil`, as well as application logs from Windows file system.Supports 3 filtering modes:
- **Default** - case sensitive exact search.
- **Fuzzy** (like `fzf`) - custom inexact case-insensitive search (searches for all phrases separated by a space anywhere on a line).
- **Regex** (like `grep`) - search with regular expression support, based on the built-in [regexp](https://pkg.go.dev/regexp) library, case-insensitive by default (in case a regular expression syntax error occurs, the input field will be highlighted in red).## Coloring
Supported coloring groups for output:
- **Custom** - URLs, file paths and processes in UNIX.
- **Yellow** - known names (host name and system users) and warnings.
- **Green** - keywords indicating success.
- **Red** - keywords indicating error.
- **Blue** - statuses (info, debug, etc), actions (install, update, etc) and HTTP methods (GET, POST, etc).
- **Light blue** - numbers (date, time, bytes, versions, percentage, integers, IP and MAC addresses).A full list of all keywords can be found in the [color.log](/color.log) file (used for testing only). If you have suggestions for improving coloring (e.g. adding new words), you can open an [issue](https://github.com/Lifailon/lazyjournal/issues) for a new feature.
Coloring directly affects the loading time of the log, to increase the performance of reading large logs, it is possible to disable coloring using the `Ctrl+Q`.
## Install
Binaries are available for download on the [releases](https://github.com/Lifailon/lazyjournal/releases) page.
List of supported systems and architectures in which functionality is checked:
| OS | amd64 | arm64 | Systems |
| - | - | - | - |
| Linux | ✔ | ✔ | Raspberry Pi (`aarch64`), Oracle Linux (RHEL-based in WSL environment), Arch Linux, Rocky Linux, Ubuntu Server 20.04.6 and above. |
| Darwin | ✔ | ✔ | macOS Sequoia 15.2 `x64` on MacBook and the `arm64` in GitHub Actions. |
| BSD | ✔ | | OpenBSD 7.6 and FreeBSD 14.2. |
| Windows | ✔ | | Windows 10 and 11. |### Unix-based
Run the command in the console to quickly install or update the stable version for Linux, macOS or the BSD-based system:
```shell
curl -sS https://raw.githubusercontent.com/Lifailon/lazyjournal/main/install.sh | bash
```This command will run a script that will download the latest executable from the GitHub repository into your current user's home directory along with other executables (or create a directory) and grant execution permission.
Or you can install manually from `deb` or `snap` package:
```bash
curl -L -sS https://github.com/Lifailon/lazyjournal/releases/download/0.7.7/lazyjournal-0.7.7-amd64.deb -o /tmp/lazyjournal.deb
sudo dpkg -i /tmp/lazyjournal.debcurl -L -sS https://github.com/Lifailon/lazyjournal/releases/download/0.7.7/lazyjournal-0.7.7-amd64.snap -o /tmp/lazyjournal.snap
sudo snap install /tmp/lazyjournal.snap --dangerous --classic
```### Arch Linux
If you an Arch Linux user you can also install from the [AUR](https://aur.archlinux.org/packages/lazyjournal):
```shell
paru -S lazyjournal
```### Conda / mamba / pixi (Linux / macOS / Windows)
If you use package managers like conda or mamba, you can install `lazyjournal` from [conda-forge](https://anaconda.org/conda-forge/lazyjournal):
```shell
conda install -c conda-forge lazyjournal
mamba install -c conda-forge lazyjournal
```You can install `lazyjournal` user-globally using [pixi](https://prefix.dev):
```shell
pixi global install lazyjournal
```### Homebrew (macOS / Linux)
Use the following command to install `lazyjournal` using [Homebrew](https://formulae.brew.sh/formula/lazyjournal):
```shell
brew install lazyjournal
```### Docker (Debian-based)
To run the interface in a container, download [docker-compose](/docker-compose.yml) and use the image from [Docker Hub](https://hub.docker.com/r/lifailon/lazyjournal):
```shell
mkdir lazyjournal && cd lazyjournal
curl -sS https://raw.githubusercontent.com/Lifailon/lazyjournal/main/docker-compose.yml -o docker-compose.yml
docker-compose up -d
docker exec -it lazyjournal lazyjournal
```The image is based on Debian with `systemd` and docker cli pre-installed. The necessary **read-only** permissions are already preset in `docker-compose` to support all log sources from the host system (review it to customize for your individual use).
Supports running in the web interface via [ttyd](https://github.com/tsl0922/ttyd) and mouse control. To do this, edit the variables in the `.env` file:
```shell
TTYD=true
PORT=5555
# Credentials for accessing the Web interface (optional)
USERNAME=admin
PASSWORD=admin
```### Windows
Use the following command to quickly install in your PowerShell console:
```PowerShell
irm https://raw.githubusercontent.com/Lifailon/lazyjournal/main/install.ps1 | iex
```The following directories are used to search for logs in the file system:
- `Program Files`
- `Program Files (x86)`
- `ProgramData`
- `AppData\Local` and `AppData\Roamin` for current userTo read logs, automatic detection of the following encodings is supported:
- `UTF-8`
- `UTF-16 with BOM`
- `UTF-16 without BOM`
- `Windows-1251` by default### Go Package
You can also use Go for install the dev version ([Go](https://go.dev/doc/install) must be installed in the system):
```shell
go install github.com/Lifailon/lazyjournal@latest
```## Usage
You can run the interface from anywhere:
```
lazyjournal Run interface
lazyjournal --help, -h Show help
lazyjournal --version, -v Show version
lazyjournal --audit, -a Show audit information
lazyjournal --tail, -t Change the number of log lines to output (default: 100000, range: 5000-200000)
lazyjournal --update, -u Change the auto refresh interval of the log output (default: 5, range: 2-10)
lazyjournal --disable-color, -d Disable output coloring
lazyjournal --command-color, -c Coloring in command line mode
```Access to all system logs and containers may require elevated privileges for the current user.
If your system uses [rsyslog](https://www.rsyslog.com) to collect logs from remote systems, you will be able to search for logs and analyze them from a single interface.
Information in the subtitle of the `Logs` window:
- `tail` - maximum number of log lines to load.
- `update` - current output auto-update status (disabled when manually scrolling the output).
- `interval` - auto-update interval for output in seconds (file logs are updated only when there are changes).
- `color` - whether the output coloring mode is currently enabled or disabled.Also output coloring is supported in command line mode:
```shell
alias lj=lazyjournal
cat /var/log/syslog | lj -c
```## Build
Clone the repository and run the project:
```shell
git clone https://github.com/Lifailon/lazyjournal
cd lazyjournal
go run main.go
```Use make or [go-task](https://github.com/go-task/task) to build binaries for different platforms and systems:
```shell
make build
# or
task build
```Check the source code on the base linters using [golangci-lint](https://github.com/golangci/golangci-lint) (including critic and security):
```shell
make lint
```## Testing
Unit tests cover all main functions and interface operation.
```shell
make list # get a list of all tests
make test n=TestMockInterface # run the selected test
```The test coverage report using CI Actions for Linux, macOS and Windows systems is available on the [Wiki](https://github.com/Lifailon/lazyjournal/wiki) page.
Testing in BSD-based systems is done in a home environment using [usup](https://github.com/Lifailon/usup).
## Hotkeys
- `F1` - show help on hotkeys.
- `Tab` - switch between windows.
- `Shift+Tab` - return to previous window.
- `Enter` - selection a journal from the list to display log output.
- `Left/Right` - switch between journal lists in the selected window.
- `` and `` - move up and down through all journal lists and log output, as well as changing the filtering mode in the filter window.
- `+` - quickly move up and down through all journal lists and log output every `10` or `100` lines (`500` for log output).
- `+` - quickly move up and down (alternative for macOS).
- `Ctrl+A` or `Home` - go to top of log.
- `Ctrl+E` or `End` - go to the end of the log.
- `Alt+Left/Right` - change the number of log lines to output (default: `100000`, range: `5000-200000`).
- `Shift+Left/Right` - change the auto refresh interval of the log output (default: `5`, range: `2-10`).
- `Ctrl+Q` - enable or disable built-in output coloring.
- `Ctrl+S` - enable or disable coloring via [tailspin](https://github.com/bensadeh/tailspin).
- `Ctrl+R` - update all log lists.
- `Ctrl+W` - clear text input field for filter to quickly update current log output.
- `Ctrl+C` - exit.## Contributing
Since this is my first Go project, there may be some bad practices, BUT I want to make `lazyjournal` better. Any contribution will be appreciated! If you want to implement any new feature or fix something, please [open an issue](https://github.com/Lifailon/lazyjournal/issues) first.
Thanks to all participants for their contributions:
- [Matteo Giordano](https://github.com/malteo) for upload and update the package in `AUR`.
- [Ueno M.](https://github.com/eunos-1128) for upload and update the package in `Homebrew` and `Conda`.You can also upload the package yourself to any package manager you use and make [Pull Requests](https://github.com/Lifailon/lazyjournal/pulls).
## Alternatives
- [Lnav](https://github.com/tstack/lnav) - The Logfile Navigator is a log file viewer for the terminal.
- [TooLong](https://github.com/Textualize/toolong) - A terminal application to view, tail, merge, and search log files.
- [Dozzle](https://github.com/amir20/dozzle) - A small lightweight application with a web based interface to monitor Docker logs.If you like using TUI tools, try [multranslate](https://github.com/Lifailon/multranslate) for translating text in multiple translators simultaneously and LLM, with support for translation history and automatic language detection.
## License
This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
Copyright (C) 2024 Lifailon (Alex Kup)