A command-line utility for diff'ing log files.
Quickly find difference lines in all kinds of logs,
namely build/CI logs, server/container logs,
journald and boot/dmesg logs, or any similar such.
Figure out quickly what changed and why exactly your shit is failing.
The script works by simply replacing common stochastic string patterns,
such as datetime timestamps, download speeds, temporary filenames,
HTTP header values, UUIDs, hash digests etc. etc. with known fixed
values that a tool such as diff can then easily skip,
ensuring your focus on critical lines only.
Installation
First, check if your OS distro already provides an installable diff-logs package.
Otherwise:
- Star, download or clone repo. 🫶
- Put
diff-logsscript into your bin-dir or elsewhere on$PATH:curl -vL https://github.com/kernc/diff-logs/raw/refs/heads/master/diff-logs sudo tee /usr/local/bin/diff-logs sudo chmod +x /usr/local/bin/diff-logs
Usage
$ diff-logs --help Usage: diff-logs < FILE1.log # Print log file diff-friendly diff-logs FILE1.log FILE2.log # Invoke $DIFFTOOL (e.g. diff)
Examples
Diff two log files
diff-logs FILE1 FILE2 # Invokes `diff` # or export DIFFTOOL=meld diff-logs FILE1 FILE2 # Invokes `meld`
Diff-friendly-format a single log file
diff-logs < FILE1 > FILE1.clean
Notes
This would be Python, but basic Perl is far more ubiquituous.
Finally, we can diff our logs with ease! 🥳
Improvements and additions welcome!