File sa_cache.pod of Package sendmailanalyzer

=head1 NAME

SendmailAnalyzer Cache Statistic Creator - Sendmail/Postfix log analyzer


SendmailAnalyzer collect maillog entries to write datas to flat files,
when you run the CGI script sa_report.cgi it had to read each data files
for the given period to compute statistics and output HTML reports.
This can be enought for day views but when you jump to month view it
cost a lot in CPU and memory usage unless you have a home MTA.

To speed up things and free system resources you have to run the script
sa_cache each night by cron to create cache files. After that viewing
a month or year view take less than a second.

If you have set per domain report sa_cache will create cache files for each
domains. These cache files are name for the MTA global statistics
and cache.pmYOURDOMAIM.DOM for each domain report. To lowered the memory
footprint of the sa_cache program, since version 8.0 it start computing cache
file per hours.

Since version 4.0 sa_report.cgi will warm you to avoid out of memory when
your entering a month view without caching.

=head1 USAGE

=head2 Huge MTA activity

On MTA server with very huge activity you can experience out of memory or
wait a very long time before seeing anything in day view. In this case you
must run by cron job the perl script sa_cache with the -a option to build
cache files for the current day. Statistics will not be shown in realtime but
only at the time of the last sa_cache run. You can run it each five minute for
example as follow:

    */5 * * * * /usr/sbin/sa_cache -a


    */5 * * * * /usr/sbin/sa_cache --actual-day-only

It will only parse data stored in the current day so five minutes interval
may be enough for most case.

=head2 Archiving

When sa_cache is run and following the value of the FREE_SPACE configuration
option it will try to archive data older than the current month. If FREE_SPACE
is set to 'delete' sa_cache will simply remove the data file from disk. If you
set it to 'archive', sa_cache will build a gzipped tarball for all daily data
file into the corresponding month directory and the remove date file from disk.

If you set it to 'none', data file are kept.

If you're primary concerned in disk space saving set it to 'delete'. If you
want to preserve data for a year or more you can safely set it to 'archive'.
For your information one of my server has 100,000 inbound message a day and
a year of 'archive' storage take around 1Gb and a 'delete' storage around

=head2 Options

sa_cache knows the following options:

        -c | --config file
        -d | --date  "yyyy/mm"
        -h | --help
        -s | --syslog  hostname
        -a | --actual-day-only

=over 4

=item B<--config> F<file>

Path to sendmailanalyzer configuration file. Default: /etc/sendmailanalyzer.conf

=item B<--date>

Year/month cache to proceed. Default is all month/year.

=item B<--syslog>

syslog name of the host to proceed. Default all.

=item B<--actual-day-only>

Proceed only the current day, this option replace the old and obsolete day_cache script.
You still have to run it often like each five minutes.


=head1 AUTHOR

Gilles Darold <gilles @nospam@>


Copyright (c) 2002-2012 Gilles Darold - All rights reserved.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see < >.

=head1 BUGS

Your volontee to help construct a better software by submitting bug report or
feature request as well as code contribution are welcome.


Thank to for the kind permission to use the "Bat" logo.

openSUSE Build Service is sponsored by