SkillAgentSearch skills...

Logalize

Fast and extensible log colorizer Alternative to ccze

Install / Use

/learn @deponian/Logalize
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<picture> <source media="(prefers-color-scheme: dark)" srcset="images/avif/logo-dark.avif"> <source media="(prefers-color-scheme: light)" srcset="images/avif/logo-light.avif"> <img alt="Screenshot" src="images/avif/logo-light.avif"> </picture>

93% of all logs are not colored[^1]. It's sad. Maybe even illegal. It's time to logalize them. Logalize is a log colorizer like colorize and ccze. But it's faster and, much more importantly, it's extensible. No more hardcoded templates for logs and keywords. Logalize is fully customizable via logalize.yaml where you can define your formats, keyword patterns and more.

<p align="center"> <a href="https://github.com/deponian/logalize/actions"><img src="https://github.com/deponian/logalize/actions/workflows/tests.yml/badge.svg" alt="Build Status"></a> <a href="https://codecov.io/gh/deponian/logalize"><img src="https://codecov.io/gh/deponian/logalize/graph/badge.svg?token=8NJ4ZC8COT"/></a> <a href="https://goreportcard.com/report/github.com/deponian/logalize"><img src="https://goreportcard.com/badge/github.com/deponian/logalize" alt="Go Report Card"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a> <a href="https://github.com/deponian/logalize/releases/latest"><img src="https://img.shields.io/github/v/release/deponian/logalize" alt="Github Release"></a> <a href="https://ko-fi.com/M4M41I8ECW"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FF5E5B?logo=kofi&logoColor=white" alt="Ko-fi"></a> </p>

Usage

cat /path/to/logs/file.log | logalize
<picture> <source media="(prefers-color-scheme: dark)" srcset="images/avif/screenshot-dark.avif"> <source media="(prefers-color-scheme: light)" srcset="images/avif/screenshot-light.avif"> <img alt="Screenshot" src="images/avif/screenshot-light.avif"> </picture>

Installation

Download DEB, RPM, Arch Linux packages, or the binary for your architecture, from releases.

Ubuntu/Debian:

sudo dpkg -i logalize_X.X.X_linux_amd64.deb

Fedora/Red Hat Enterprise Linux/CentOS:

sudo rpm -i logalize_X.X.X_linux_amd64.rpm

Arch Linux/Manjaro:

sudo pacman -U logalize_X.X.X_linux_amd64.pkg.tar.zst

or install from the AUR:

# to install the precompiled binary
yay -S logalize-bin

# to compile it on your machine
yay -S logalize

macOS:

brew install deponian/tap/logalize

OS-agnostic:

Use go install if you already have $GOPATH/bin in your $PATH:

go install github.com/deponian/logalize@latest

How it works

Logalize reads one line from stdin at a time and then checks if it matches one of the formats (formats), general regular expressions (patterns), or plain English words and their inflected forms (words). See configuration below for more details.

Simplified version of the main loop:

  1. Read a line from stdin.
  2. Strip all ANSI escape sequences (see the settings section below).
  3. If the entire line matches one of the formats, print the colored line and go to step 1; otherwise, go to step 4.
  4. Find and color all patterns in the line, then go to step 5.
  5. Find and color all words, print the colored line, and go to step 1.

Configuration

Logalize looks for configuration files in these places:

  • /etc/logalize/logalize.yaml
  • ~/.config/logalize/logalize.yaml
  • .logalize.yaml in the current directory
  • path(s) from -c/--config flag (can be repeated)

If more than one configuration file is found, they are merged. The lower the file in the list, the higher its priority.

A configuration file can contain five top-level keys: formats, patterns, words, themes, and settings. In the first three, you define what you want to match, and in themes you describe how you want to colorize them. settings lets you set options if you don't want to pass them as flags.

Formats

Configuration example:

formats:
  kuvaq:
    - regexp: (\d{1,3}(\.\d{1,3}){3} )
      name: ip-address
    - regexp: (- )
      name: dash
    - regexp: ("[^"]+" )
      name: string
    - regexp: (\d\d\d)
      name: http-status-code
      alternatives:
        - regexp: (2\d\d)
          name: 2xx
        - regexp: (3\d\d)
          name: 3xx
        - regexp: (4\d\d)
          name: 4xx
        - regexp: (5\d\d)
          name: 5xx

formats describe complete formats. A line must match a format completely to be colored. For example, the full regular expression for the "kuvaq" format above looks like this:
^(\d{1,3}(\.\d{1,3}){3} )(- )("[^"]+" )(\d\d\d)$

Only the lines below will match this format:

  • 127.0.0.1 - "menetekel" 200
  • 7.7.7.7 - "m" 404

But not these:

  • 127.0.0.1 - "menetekel" 503 lower ascension station
  • Upper ascension station 127.0.0.1 - "menetekel" 403
  • 127.0.0.1 - "menetekel" 404000

For an overview of regular expression syntax, see the regexp/syntax package.

Full format example using all available fields:

formats:
  # Name of a format
  elysium:
    # Regexp must begin with an opening parenthesis `(`
    # and it must end with a paired closing parenthesis `)`
    # Regexp can't be empty `()`
    # That is, your regexp must be within one capturing group
    # and contain a valid regular expression.
    - regexp: (\d\d\d )
      # Name of the capturing group.
      # It will be used to assign colors and style
      # later in the "themes" section (see below).
      name: capgroup-name
      # Alternatives are useful when you have a general regular expression
      # but want different colors for a specific subset of cases
      # within this regular expression.
      # A common example is an HTTP status code.
      alternatives:
        # Every regexp here has the same "name" field
        # and no "alternatives" field.
        - regexp: (2\d\d )
          name: 2xx
        - regexp: (4\d\d )
          name: 4xx
    # Each subsequent regexp is added to the previous one,
    # and together they form a complete regexp for the whole string
    - regexp: (--- )
      name: dashes
    - regexp: ([[:xdigit:]]{32})
      name: hash
    # Full regexp for this whole example:
    # ^(\d\d\d )(--- )([[:xdigit:]]{32})$

You can find built-in formats here. If you want to customize them or turn them off completely, overwrite the corresponding values in your logalize.yaml. See the Customization section below for more details.

Patterns

Configuration example:

patterns:
  # Simple patterns (one regexp)
  string:
    priority: 500
    regexp: ("[^"]+"|'[^']+')

  number:
    regexp: (\d+)

  # Complex pattern (built from a list of regexps)
  ipv4-address-with-port:
    regexps:
      - regexp: (\d{1,3}(\.\d{1,3}){3})
        name: address
      - regexp: ((:\d{1,5})?)
        name: port

patterns are standard regular expressions. You can highlight any sequence of characters in a string that matches a regular expression. A pattern may consist of several parts (see ipv4-address-with-port above). This is convenient if you want different parts of a pattern to have different colors or styles. Think of these complex patterns as small formats that can be found in any part of a string.

Patterns have priority. Those with higher priority will be painted earlier. The default priority is 0. The priorities of the built-in patterns are between -100 and 100.

Full pattern example using all available fields:

patterns:
  # Simple pattern (when you use only "regexp" field)
  # Name of a pattern
  http-status-code:
    # Patterns with higher priority will be painted earlier;
    # the default priority is 0.
    priority: 10
    # The same fields are used here as in formats (see above).
    regexp: (\d\d\d)
    # Patterns can have alternatives just like in formats.
    alternatives:
      - regexp: (2\d\d)
        name: 2xx
      - regexp: (3\d\d)
        name: 3xx
      - regexp: (4\d\d)
        name: 4xx
      - regexp: (5\d\d)
        name: 5xx

  # Complex pattern (when you use the "regexps" field)
  # The same fields are used here as in formats (see above).
  # Complex patterns are formed from all regexps in the "regexps" list.
  # For example, the pattern below will be rendered as (\d{1,3}(\.\d{1,3}){3})((:\d{1,5})?)
  # The main difference from a simple pattern is that you can control
  # the style of the individual parts of the pattern.
  ipv4-address-with-port:
    regexps:
      - regexp: (\d{1,3}(\.\d{1,3}){3})
        name: address
      - regexp: ((:\d{1,5})?)
        name: port

  # Complex patterns are mainly used when you want to build a pattern
  # that builds on other patterns. For example, you may want to make a highlighter
  # for the "logfmt" format. An example of a "logfmt" log line:
  # ts=2024-02-16T23:00:02.953Z caller=db.go:16 level=info component=tsdb msg="Deleting..."
  # You can't use formats (see above) because the structure of "logfmt" is variable.
  # In such a case, you can describe the base "logfmt" element (xxx=xxx) and look for other
  # existing patterns (date, time, IP address, etc.) on the right side of the equals sign
  # (see how to accomplish this below in the "themes" section).
  logfmt:
    regexps:
      - regexp: ( [^=]+)
        name: key
      - regexp: (=)
        name: equal-sign
      - regexp: ([^ ]+)
        name: value

You can find built-in patterns here. If you want to customize them or turn them off completely, overwrite the corresponding values in your logalize.yaml. See Customization section below for more details.

Words

Configuration example:

`

Related Skills

View on GitHub
GitHub Stars120
CategoryDevelopment
Updated16h ago
Forks1

Languages

Go

Security Score

100/100

Audited on Mar 30, 2026

No findings