百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

hl

> 开发工具
开源

这是一个快速而强大的日志查看器和处理器,可将 JSON 日志或 logfmt 日志转换为清晰易读的格式。

3.2K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

这是一个快速而强大的日志查看器和处理器,可将 JSON 日志或 logfmt 日志转换为清晰易读的格式。

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 -P flag, which disables the pager.
  • Field-Based Filtering: Filter log records by key/value pairs using the -f option, with support for hierarchical keys.
  • Level Filtering: Easily filter logs by level with the -l option.
  • Timestamp Range Filtering: Filter logs by timestamp range using the --since and --until options with intuitive formats:
    • RFC-3339 timestamp format.
    • Current configured timestamp output format (via the -t option or environment variable).
    • User-friendly shortcuts like today, yesterday, friday, or relative offsets such as -3h or -14d.
  • Field Visibility Control: Quickly hide or reveal specific fields using the -h option.
  • Empty Field Hiding: Automatically hide empty fields with the -e flag.
  • Field Expansion: Control multi-line field and message formatting with the -x option:
    • 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 -s flag.
    • 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 -F flag for live, timestamp-sorted message updates across multiple sources, with a preview of recent messages via the --tail option.
  • 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-prefix flag.
  • Timezone Flexibility: Displays timestamps in UTC by default while allowing effortless timezone switching with the -Z option or local timezone adjustments using the -L flag.
  • 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

    bash
    brew install hl
Other options
  • Download and extract using curl and tar on macOS

    bash
    curl -sSfL https://github.com/pamburus/hl/releases/latest/download/hl-macos.tar.gz | tar xz
  • Install using cargo

    bash
    cargo install --locked --git https://github.com/pamburus/hl.git
  • Download latest release from download page

Linux

  • Download and extract using curl and tar on Linux (x86_64)

    bash
    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

    bash
    pacman -S hl
Other options
  • Download and extract using curl and tar on Linux (arm64/aarch64)

    bash
    curl -sSfL https://github.com/pamburus/hl/releases/latest/download/hl-linux-arm64-musl.tar.gz | tar xz
  • Install using cargo

    bash
    cargo install --locked --git https://github.com/pamburus/hl.git

Windows

  • Install from Scoop

    bash
    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 LESS environment variable to -R --mouse.

[!IMPORTANT] Currently, hl does 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 with hl and 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 install hl by running scoop install hl, it already installs less automatically as a dependency. Just make sure you do not have any other conflicting installations by running where less in cmd or Get-Command less in powershell.

  • Download latest release from download page
Other options
  • Install using cargo

    bash
    cargo install --locked --git https://github.com/pamburus/hl.git

NixOS

  • Run using nix

    bash
    nix run github:pamburus/hl

    or binary package

    bash
    nix run github:pamburus/hl#bin

    or install with nix profile:

    bash
    nix profile add github:pamburus/hl

    or binary package

    bash
    nix profile add github:pamburus/hl#bin
  • Install the package from source using nix-flakes

    Example how to update nix configuration
    nix
    {
      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

    Example how to update nix configuration
    nix
    {
      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

</picture>

See other screenshots

Features and usage

Concatenation of multiple log files

  • Concatenate all log files

    Command

    bash
    hl *.log

    Concatenates and displays all *.log files found in the current directory.

Support for compressed (bzip2, gzip, xz, zstd) log files

  • Concatenate all log files including compressed log files

    Command

    bash
    hl $(ls -tr /var/log/example/*.{log,log.gz,log.zst,s})

    Concatenates and displays all *.log, *.log.gz, *.log.zst and *.s (will detect compression) files found in /var/log/example/.

Automatic usage of pager

  • Use the default pager with the default parameters

    Command

    bash
    hl example.log

    Automatically opens less pager with the default parameters.

  • Override options for default pager

    Command

    bash
    LESS=-SR hl example.log

    Opens less pager with disabled line wrapping.

  • Use custom pager

    Command

    bash
    PAGER="most -w" hl example.log

    Opens most pager with -w option.

Quick filtering by log level

  • Errors only

    Command

    bash
    hl -l e

    Displays only error log level messages.

  • Errors and warnings

    Command

    bash
    hl -l w

    Displays only warning and error log level messages.

  • Errors, warnings and informational

    Command

    bash
    hl -l i

    Displays all log messages except debug level messages.

Using live log streaming

  • Command

    bash
    tail -f example.log | hl -P

    Tracks changes in the example.log file and displays them immediately. Flag -P disables automatic using of pager in this case.

Filtering by field values

  • Command

    bash
    hl example.log --filter component=tsdb

    Displays only messages where the component field has the value tsdb.

  • Command

    bash
    hl example.log -f component!=tsdb -f component!=uninteresting

    Displays only messages where the component field exists and has a value other than tsdb or uninteresting.

  • Command

    bash
    hl example.log -f provider~=string

    Displays only messages where the provider field contains the string sub-string.

  • Command

    bash
    hl example.log -f 'provider!~=string'

    Displays only messages where the provider field exists and does not contain the string sub-string.

  • Command

    bash
    hl example.log -f 'request.method?!=GET'

    Displays only messages where the request.method field does not exist or exists and is not equal to GET. In JSON messages, this also matches composite fields, e.g., {"request":{"method":"POST"}}.

  • Com

Issues· 13 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustclicommand-line-toolhlhuman

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具