NAME - Displays running HTTP logs to a terminal with pretty colors

SYNOPSIS [-c configfile]


Allows an admin to view multiple Apache HTTP logs color coded for easy viewability as they're written. Also hilights incoming referrer strings and has a built in ``grep -v'' style mechanism to prevent information overload. This script is specifically written for the ``Combined'' log format.

Logs are followed using File::Tail, then parsed, munged, and displayed in the ANSI color specified by the configfile. A sample line (note: the line measures 80 characters plus newline so it may wrap on your display):

05:54 bob user-92.bhm2| /parties/electro/pages/CarolAlVideo.html 200


05:54 = hh:mm pulled from log

bob = The username used in HTTP auth. or ``-'' if anonymous.

user-92.bhm2| = a munged client hostname (note the pipe)

/parties/electro/pages/CarolAlVideo.html = the HTTP request. Method only shows when its not a GET. Protocol is discarded

200 = HTTP return code

The client hostname will be munged to no less than 23 characters (including separator) and should always be missing an ``even'' middle +/- 1 character. Get it?

If the munged client hostname is already at minimal size and the request is still too long to fit it all in the alotted space, the request is then truncated from the front so you see the tail end of it. Tack plaintext descriptions with meaningless variables onto the end of long URL query strings in your code.

If a request comes in with a referrer string that does not match the refer config option, the URL is printed in that logs' color bolded.


The default config file location is ~/.weblogtailrc

-c configfile


The config file is straight perl because I couldn't think of an easier human-readable format. The config file gets eval()'d after the defaults are set so a user may override the $width and $tailcount settings if they so choose. The main config variable is %conf.

%conf = ( '/path/to/apache/log/file' => { 'refer' => '', 'color' => 'green' 'ignore' => '\.(gif|jpg)$' } );

A regex of this file's possible hostname(s) to be ignored in the referrer tags. If a hit comes in with a referrer not in this RE, a bolded line will be printed to say so. Very cool for recognizing search engine hits in real-time.

Defines the display color for this log. See Term::ANSIColor(3) for different options. Do not use bold here because its used by the referrer routines.

A regex applied negatively against the user request (GET /blah/blah/blah up to `` HTTP/1.[01]'' exclusive) so your display doesn't get slammed by graphics intensive requests for instance.


Frank Johnson <ratty at>. Copyright (c) 2003

Distributable under the Gnu GPL version 2