What does ColorTail do for me?

ColorTail provides a cool way for you to configure how logfiles (or any other files for that matter) look when you tail them.


Install the gem

gem install colortail

Using ColorTail

By default, ColorTail does absolutely nothing other than just tail a file normally (similar to the trust old unix tool 'tail -f'). But what good what writing a gem be if it just mimiced existing functionality.

Conifguring ColorTail

Configuring ColorTail is easy. In your home directory, create a file .colortailrc. This file will contain a group of ruby arrays similar to the ones laid out in the example config examples/colortail.rb. These arrays are called groups. Any group can be loaded via the command line using the -g switch (more on this below).

The standard configuration file is .colortailrc. It needs to be in the format of a Ruby hash.

The full list of choices for colors and combinations are listed below.



Additional Colors

To get the additional colorset listed below, use the bright attribute.

Configuration Example

The example given in the configuration file is good for tailing a syslog file that has lines that are naemd with their syslog level. There are a lot of potential uses. Check the wiki page of example groupings to see how others are using ColorTail.


Using ColorTail is similar to using tail. The main assumption is that you will always be indefinitely tail'ing a file.

Tailing with groups

The command below will tail the /var/log/messages file using the syslog group. The example config examples/colortail.rb shows a syslog grouping that is used in command below (the below 2 commands are equivilent):

# colortail -g syslog /var/log/messages
# cat /var/log/messages | colortail -g syslog

Tailing multiple files

To tail multiple files can be confusing, especially when you don't know which file you are seeing. Use the -F option to show the filenames at the beginning of each colored line.

# colortail -F -g syslog /var/log/messages /var/log/secure.log

Tailing multiple files using different color groups

You can also tail multiple files using different color groups. Currently, the separater is #. If no grouping is specified with the file or the grouping specified doesn't exist, colortail will default to the one specied on the command line.

# colortail /var/log/messages#syslog /var/log/secure.log#otherlog
# colortail -g syslog /var/log/messags#nosuchgroup /var/log/secure.log#secure

Caveats and Intended Behaviors

ColorTail intentionally does not die when a file specified on the command line doesn't exist.

Additional Information


Eric Lubow <eric at lubow dot org>

Note on Patches/Pull Requests


Copyright (c) 2010 Eric Lubow. See LICENSE for details.