Skip to main content

Colorby

Colorby is a Python program that makes it easier to understand interleaved log lines by coloring each line based on a matching part.

Example:

# Color some logs from systemd based on service name
$ journalctl _COMM=systemd --since -20m | grep '\.service' | colorby '\S+\.service'
Jun 07 14:36:03 iroh systemd[1]: Starting NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service...
Jun 07 14:36:03 iroh systemd[1]: Started NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service.
Jun 07 14:36:13 iroh systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Jun 07 14:37:59 iroh systemd[1]: Starting packagekit.service - PackageKit Daemon...
Jun 07 14:37:59 iroh systemd[1]: Started packagekit.service - PackageKit Daemon.
Jun 07 14:37:59 iroh systemd[1]: Starting flatpak-system-helper.service - flatpak system helper...
Jun 07 14:37:59 iroh systemd[1]: Started flatpak-system-helper.service - flatpak system helper.
Jun 07 14:43:09 iroh systemd[1]: packagekit.service: Deactivated successfully.
Jun 07 14:43:09 iroh systemd[1]: packagekit.service: Consumed 1.177s CPU time, 120.1M memory peak.
Jun 07 14:47:59 iroh systemd[1]: flatpak-system-helper.service: Deactivated successfully.
Jun 07 14:51:10 iroh systemd[1]: Starting fprintd.service - Fingerprint Authentication Daemon...
Jun 07 14:51:10 iroh systemd[1]: Started fprintd.service - Fingerprint Authentication Daemon.
Jun 07 14:51:40 iroh systemd[1]: fprintd.service: Deactivated successfully.

Note how this makes it easier to identify the lines corresponding to each service despite their interleaving.

(If you’re reading this on GitHub, you won’t see the colors. Read it on lumeh.org instead!)

Usage

For one-off uses, I recommend running the tool via uvx or pipx:

$ uvx colorby --help
usage: colorby [mode options] [other options] [REGEX]

Color each line from stdin based on its key identified by REGEX.
[…]

For more regular use, install the package using your preferred Python package manager.

Metadata

Release files for colorby 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colorby 1.0.0
File Size Uploaded Provenance Actions
colorby-1.0.0.tar.gz 5.3 kB Without provenance Details for colorby-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for colorby 1.0.0
File Interpreter ABI Platform Actions
colorby-1.0.0-py3-none-any.whl Python 3 none any Details for colorby-1.0.0-py3-none-any.whl

Total release size: 11.7 kB

Release files / colorby-1.0.0.tar.gz

Download URL colorby-1.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
675749ed68c6bb7b5b8c9318f6947bbb2c9267f67a0f3cb5a5b219b6c9808d50
BLAKE2b-256 checksum
How to use checksums
8ff7823da53cf155ae21c6d5d982714f6c256af1f3750772519fcc6632021146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.12

Release files / colorby-1.0.0-py3-none-any.whl

Download URL colorby-1.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0feb13786af9e93515203e48bce10607f4431a60758bbef62af61fe01c5867b9
BLAKE2b-256 checksum
How to use checksums
b04c0b5f3660fe4222c22bf39dacb4786eab1b8c3e1feaca7a6e092fc742caa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.12

Security for colorby 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page