Hl
A fast and powerful log viewer and processor that converts JSON logs or logfmt logs into a clear human-readable format.
Install / Use
/learn @pamburus/HlREADME
hl [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Release][release-img]][release]
High-performance log viewer and processor that transforms logs in JSON and logfmt formats into a human-readable output. Built with efficiency in mind, it enables quick parsing and analysis of large log files with minimal overhead.
Features overview
- Automatic Pager Integration: Automatically integrates with a pager for enhanced convenience, defaulting to less if available, but fully supporting any compatible pager.
- Log Streaming Mode: Enable log streaming with the
-Pflag, which disables the pager. - Field-Based Filtering: Filter log records by key/value pairs using the
-foption, with support for hierarchical keys. - Level Filtering: Easily filter logs by level with the
-loption. - Timestamp Range Filtering: Filter logs by timestamp range using the
--sinceand--untiloptions with intuitive formats:- RFC-3339 timestamp format.
- Current configured timestamp output format (via the
-toption or environment variable). - User-friendly shortcuts like
today,yesterday,friday, or relative offsets such as-3hor-14d.
- Field Visibility Control: Quickly hide or reveal specific fields using the
-hoption. - Empty Field Hiding: Automatically hide empty fields with the
-eflag. - Field Expansion: Control multi-line field and message formatting with the
-xoption:never: Compact single-line output with escaped newlines.inline: Preserve newlines as-is in the output.auto: Automatically expand fields containing multi-line content.always: Expand all fields into structured multi-line format.
- High-Speed Message Sorting: Achieve lightning-fast message sorting with automatic indexing via the
-sflag.- Performs the initial scan at approximately 2 GiB/s, enabling rapid filtering by timestamp and level without re-scanning.
- Efficiently handles hundreds of local files totaling hundreds of gigabytes.
- Reindexes large, growing files at speeds up to roughly 10 GiB/s by skipping unmodified blocks.
- Live Follow Mode: Use the
-Fflag for live, timestamp-sorted message updates across multiple sources, with a preview of recent messages via the--tailoption. - Complex Query Support: Construct custom queries with logical conditions (AND/OR) and additional advanced filtering options.
- Non-JSON Prefix Handling: Process logs with non-JSON prefixes using the
--allow-prefixflag. - Timezone Flexibility: Displays timestamps in UTC by default while allowing effortless timezone switching with the
-Zoption or local timezone adjustments using the-Lflag. - Customizability and Themes: Fully customizable through configuration files and environment variables, with support for easy theme switching and custom themes.
Performance comparison chart
Performance comparison with humanlog, hlogf and fblog on a 2.3 GiB log file
- See performance section for more details.
Installation options
macOS
-
Install using homebrew on macOS
brew install hl
-
Download and extract using
curlandtaron macOScurl -sSfL https://github.com/pamburus/hl/releases/latest/download/hl-macos.tar.gz | tar xz -
Install using cargo
cargo install --locked --git https://github.com/pamburus/hl.git -
Download latest release from download page
Linux
-
Download and extract using
curlandtaron Linux (x86_64)curl -sSfL https://github.com/pamburus/hl/releases/latest/download/hl-linux-x86_64-musl.tar.gz | tar xz -
Install hl package from Arch Linux extra repository
pacman -S hl
-
Download and extract using
curlandtaron Linux (arm64/aarch64)curl -sSfL https://github.com/pamburus/hl/releases/latest/download/hl-linux-arm64-musl.tar.gz | tar xz -
Install using cargo
cargo install --locked --git https://github.com/pamburus/hl.git
Windows
-
Install from Scoop
scoop bucket add pamburus https://github.com/pamburus/scoop-bucket.git scoop install hl
[!TIP] It is recommended to use Windows Terminal for better experience.
[!TIP] To make mouse scrolling work in the less pager, set the
LESSenvironment variable to-R --mouse.
[!IMPORTANT] Currently,
hldoes not provide a built-in pager and relies on external pagers such as less. However, the build for Windows referenced on the original download page and distributed in the WinGet package manager does not work as expected. The authors state that they have not tested or verified this build and suggest that you use it at your own risk. Unfortunately, this build breaks some ANSI escape sequences and does not work properly withhland many other programs that use ANSI escape sequences for colors and styles. It is recommended to install less from the Scoop or Chocolatey package manager. If you are using Scoop and installhlby runningscoop install hl, it already installs less automatically as a dependency. Just make sure you do not have any other conflicting installations by runningwhere lessin cmd orGet-Command lessin powershell.
- Download latest release from download page
-
Install using cargo
cargo install --locked --git https://github.com/pamburus/hl.git
NixOS
-
Run using nix
nix run github:pamburus/hlor binary package
nix run github:pamburus/hl#binor install with nix profile:
nix profile add github:pamburus/hlor binary package
nix profile add github:pamburus/hl#bin -
Install the package from source using nix-flakes
<details> <summary>Example how to update nix configuration</summary>
</details>{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; hl.url = "github:pamburus/hl"; }; outputs = {nixpkgs, hl, ...}: let system = "x86_64-linux"; in { # this is just an example! nixosConfigurations.yourHost = nixpkgs.lib.nixosSystem { inherit system; modules = [ ({...}: { environment.systemPackages = [ hl.packages.${system} ]; }) ]; }; }; } -
Install the package with pre-built binaries using nix-flakes
<details> <summary>Example how to update nix configuration</summary>
</details>{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; hl.url = "github:pamburus/hl"; }; outputs = {nixpkgs, hl, ...}: let system = "x86_64-linux"; in { # this is just an example! nixosConfigurations.yourHost = nixpkgs.lib.nixosSystem { inherit system; modules = [ ({...}: { environment.systemPackages = [ hl.packages.${system}.bin ]; }) ]; }; }; }
Examples
Screenshot
<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pamburus/hl-extra/37b444fcd812563963631071af581445851aa86e/screenshot/uni/dark.svg" /> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/pamburus/hl-extra/37b444fcd812563963631071af581445851aa86e/screenshot/uni/light.svg" /> <img alt="screenshot" src="https://hl-uni.tiiny.site/dark.svg" /> </picture> </p>See other screenshots
Features and usage
Concatenation of multiple log files
-
Concatenate all log files
Command
hl *.logConcatenates and displays all
*.logfiles found in the current directory.
Support for compressed (bzip2, gzip, xz, zstd) log files
-
Concatenate all log files including compressed log files
Command
hl $(ls -tr /var/log/example/*.{log,log.gz,log.zst,s})Concatenates and displays all
*.log,*.log.gz,*.log.zstand*.s(will detect compressio
