-= OpenWebMail Statistics Generator v1.1 - Dimitrios 'sehh' Michelinakis <sehh@altered.com>

This perl script generates statistics from the openwebmail log file. These
statistics are based on monthly 'keyword' reports. These keywords are the
strings used in the log file to describe an action.

For example:

Thu Apr 22 09:34:48 2004 - [15900] (81.168.75.13) sehh - login - sehh*altered.com-session-0.319089010198699 - active=0,0,0
Fri Apr 23 02:51:26 2004 - [21049] (81.168.75.13) sehh - filter message - filter 1 msgs from INBOX to mail-trash

These two lines contain the keyword 'login' and 'filter message'. OpenWebMail
generates many kinds of these. You can generate monthly statistics based on
any kind of keyword. Some examples are: login, release upgrade, logout, login
error and filter message.


-=- Requirements:

1) GD library is the only requirement. The GD library may also depend on some
additional devel packages like: libpng-devel, libjpeg-devel, libgd and libgd-devel.

As root you may install GD for perl like this:

perl -MCPAN -e 'install GD'
perl -MCPAN -e 'install GD::Text'
perl -MCPAN -e 'install GD::Graph'

Recent linux distributions come with RPM packages of all the dependencies
for the GD library. FreeBSD has them all in the ports collection.


-=- Installation/Configuration:

Edit the script owm-stats.pl and modify the variables.

$logfile = "openwebmail.log";

 Path and filename to your openwebmail.log file.

my $prefix = "stats-";

 Prefix for the generated PNG image files. The files have the format:
 <prefix><month>-<keyword>.png, so the default generates files like
 stats-7-login.png (month=7 and keyword=login). The prefix may also
 contain a path, for example: "/var/www/html/images/stats-".

my $year = 2004;

 Year of the months requested. Used to find days of current month.

my @months = ("6","7");

 Months to generate statistics for. It is a perl array variable.

my @keywords = ("login","pop3 error");

 Keywords to search for. These are the keywords generated by OpenWebMail
 in the log file, for example: login, release upgrade, logout, login error.

$graphtitle = 'Monthly Statistics';
$graphxlabel ='Day';
$graphylabel = 'Count';

 These are the text which goes in the graph, you may translate it to other
 languages or change it to suit your needs based on the statistic data.


-=- Usage:

Just run 'perl owm-stats.pl' and the script will generate the required images.


-=- Customising the graphs:

You may customise how the graphs look like. You will need to edit the
script owm-stats.pl and at the bottom you will see something like this:

    # BLACK-WHITE
     dclrs          => [ 'black' ], # gray
     textclr        => 'black', # gray
     labelclr       => 'black', # gray
     valuesclr      => 'black', # gray
     accentclr      => 'gray',  # gray
     axislabelclr   => 'black', # gray
     legendclr      => 'gray',
     fgclr          => 'lgray',
     bgclr          => 'white',
    # COLOR
     #dclrs          => [ '#aafffa' ],
     #textclr        => 'white',
     #labelclr       => 'white',
     #valuesclr      => 'white',
     #accentclr      => 'white',
     #axislabelclr   => 'white',
     #legendclr      => 'white',
     #fgclr          => 'gray',
     #bgclr          => '#003366',

You may uncomment the COLOR section (and comment-out the BLACK-WHITE)
in order to get colored output. You may then modify the colors to
match your website theme.

There is an option to generate transparent PNG images. This can be
a bad idea because M$-crap-IE does not support transparent PNGs.


-=- ChangeLog:

1.1 - filenames don't have spaces if keyword has.
      (eg, "pop3 error" becomes pop3error.png).

1.0 - initial release

