Do your eyes a favor with colored log output

Posted on May 10, 2012

A simple solution to make log files more readable.

cat messy.log

No alternative text available

cat messy.log | colog

No alternative text available

colog ..

.. is a simple Python script, ready for your customization:

Adjust it to your needs and save it as colog (or any other name you like) somewhere in your path. Probably you want to tune the pattern matching and color codes.

Examples

Watch log output from running programs

$ a-very-verbose-program 2>&1 | colog

Watch a log file with tail

$ tail -f /path/to/some/logfile | colog

Read a log file colored in less

$ cat /path/to/some/logfile | colog | less -FRS

Need more?

If this simple solution does not solve your log file reading problems, have a try with a more powerful tool like MultiTail.