Log Colourizing with ccze: Difference between revisions

From Run Your Own
Jump to navigation Jump to search
(Created page with "Part of the extreme fun of administrating servers, is to watch endless streams of log files. It is so exciting it's hard to write this introduction without becoming indescriba...")
 
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:


== Installation and usage ==
== Installation and usage ==
* install
* install is simple
  apt install ccze
  apt install ccze
* here you go, witness the magic
* here you go, witness the magic
  ccze < /var/log/some.log
  ccze < /var/log/some.log


== PRO Tips ==
== PRO Tips ==
=== scrollback ===
=== scrollback ===
By default ccze uses curses for colourizing things. This will prevent the ability to scroll back because it will use a limited terminal emulator mode without buffer. If you have the habit to use tail -f to monitor logs in tmux or screen and scrollback from time to time, and/or hit the enter key to help visually mark a new chunk of log, then you're better off choosing the ANSI output of ccze:
By default <code>ccze</code> uses curses for colourizing things. This will prevent the ability to scroll back because it will use a limited terminal emulator mode without buffer. If you have the habit to use <code>tail -f</code> to monitor logs in <code>tmux</code> or <code>screen</code> and scrollback from time to time, and/or hit the enter key to help visually mark a new chunk of log, then you're better off choosing the ANSI output of <code>ccze</code>:
  tail -f /var/log/mail.info | ccze -A
  tail -f /var/log/mail.info | ccze -p postfix -A
 
[[File:ccze.png]]


=== Default colour schemes ===
=== Default colour schemes ===
cczve comes with
<code>cczve</code> comes with several presets for most common log files, named plugins and called with <code>-p</code> (see MAN). It can be extended as C (see source files), and the colours used can be tweaked in either <code>/etc/colorizerc</code> or <code>$HOME/.colorizerc</code>.
 
[[Category: System]]

Latest revision as of 11:20, 31 May 2018

Part of the extreme fun of administrating servers, is to watch endless streams of log files. It is so exciting it's hard to write this introduction without becoming indescribably agitated.

One thing is a bit annoying though. Log files can be often hard to parse visually and quickly given the amount of information they may contain. To solve this issue there's a thing called log colourizing, which is used to describe applications that can take a log file as an input and return a prettified version of it. There are several options for doing that but ccze is the one we like.

Installation and usage

  • install is simple
apt install ccze
  • here you go, witness the magic
ccze < /var/log/some.log

PRO Tips

scrollback

By default ccze uses curses for colourizing things. This will prevent the ability to scroll back because it will use a limited terminal emulator mode without buffer. If you have the habit to use tail -f to monitor logs in tmux or screen and scrollback from time to time, and/or hit the enter key to help visually mark a new chunk of log, then you're better off choosing the ANSI output of ccze:

tail -f /var/log/mail.info | ccze -p postfix -A

Ccze.png

Default colour schemes

cczve comes with several presets for most common log files, named plugins and called with -p (see MAN). It can be extended as C (see source files), and the colours used can be tweaked in either /etc/colorizerc or $HOME/.colorizerc.