weblogtail.pl - Displays running HTTP logs to a terminal with pretty colors
weblogtail.pl [-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|sl.pol.co.uk /parties/electro/pages/CarolAlVideo.html 200
Where:
05:54 = hh:mm pulled from log
bob = The username used in HTTP auth. or ``-'' if anonymous.
user-92.bhm2|sl.pol.co.uk = 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' => 'test.example.org', 'color' => 'green' 'ignore' => '\.(gif|jpg)$' } );
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.
Frank Johnson <ratty at they.org>. Copyright (c) 2003
Distributable under the Gnu GPL version 2
http://web.they.org/software/weblogtail.pl
http://web.they.org/software/images/weblogview2.png
weblogtail.pl v0.5