Colorize log files on CentOS and Ubuntu using ccze tool

ccze is a wonderful tool that brings real joy to the arduous task of reading or searching thru log files. It uses a modular approach to support custom colour formatting for popular applications such as Apache, Postfix, Exim, etc.

Install ccze on CentOS and Fedora linux

First enable Epel repository and run following command:

  1. # yum install ccze -y

Install ccze on Debian/Ubuntu linux

On Debian/Ubuntu, you can use apt-get to install:

  1. ~$ sudo aptget install ccze y

How to use ccze tool

ccze colourises logs that are sent to standard out, for example, we can use tailf to follow a log file and then prettify the output by piping to ccze, examples:

  1. ~$ tail /var/log/syslog | ccze A

Example using ccze tool

Export log files to html file using ccze tool:

  1. ~$ cat /var/log/syslog | ccze h >~/Desktop/syslog.html

Example:

cczz export logfile in html

This tool comes with plenty of options. You can customize it more in these files

  1. /etc/cczerc, $HOME/.cczerc

To see list of plugins available just do

  1. $ ccze l

Example output:

  1. ~$ ccze l
  2. Available plugins:
  3.  
  4. Name|Type|Description
  5. ————————————————————
  6. apm |Partial|Coloriserfor APM sublogs.
  7. distcc |Full|Coloriserfor distcc(1) logs.
  8. dpkg |Full|Coloriserfor dpkg logs.
  9. exim |Full|Coloriserfor exim logs.
  10. fetchmail |Partial|Coloriserfor fetchmail(1)sublogs.
  11. ftpstats |Full|Coloriserfor ftpstats (pureftpd) logs.
  12. httpd |Full|Coloriserfor generic HTTPD access and error logs.
  13. icecast |Full|ColoriserforIcecast(8) logs.
  14. oops |Full|Coloriserfor oops proxy logs.
  15. php |Full|Coloriserfor PHP logs.
  16. postfix |Partial|Coloriserfor postfix(1)sublogs.
  17. procmail |Full|Coloriserfor procmail(1) logs.
  18. proftpd |Full|Coloriserfor proftpd access and auth logs.
  19. squid |Full|Coloriserfor squid access, store and cache logs.
  20. sulog |Full|Coloriserfor su(1) logs.
  21. super|Full|Coloriserforsuper(1) logs.
  22. syslog |Full|Generic syslog(8) log coloriser.
  23. ulogd |Partial|Coloriserfor ulogd sublogs.
  24. vsftpd |Full|Coloriserfor vsftpd(8) logs.
  25. xferlog |Full|Generic xferlog coloriser.

For more ccze optioins see man pages.