SendmailAnalyzer Installation
-----------------------------

Requirement:
------------

You need a modern perl distribution, and some Perl modules:

	MIME::Base64;
	MIME::QuotedPrint;

In modern Perl distribution those modules are already included.


Installation and usage instruction
----------------------------------

Just unpack the distribution tarball as follow:

	tar xzf sendmailanalyzer-x.x.tar.gz
	cd sendmailanalyzer-x.x/
	perl Makefile.PL
	make && make install

Then follow the instruction given at end of the installation process. With this
default install everything will be installed under /usr/local/sendmailanalyzer.

Or if you want you can use one of the packaging tool provided in directory
packaging. See README file in this directory to know how to proceed. There's
all script need to build Slackware, RPM and Debian installation packages.


Running SendmailAnalyzer:
-------------------------

You can run SendmailAnalyzer each day by cron job or run it in
background to have realtime statistic report (recommended).

To run it by cron job use this command line :

    /usr/local/sendmailanalyzer/sendmailanalyzer -i -b -f -l /var/log/maillog

To run SendmailAnalyzer as a daemon, use the start/stop/restart script given
with the distribution (in start_script/ directory):

	/usr/local/sendmailanalyzer/rc.sendmailanalyzer start

or if you use RedHat or Fedora:

	chkconfig sendmailanalyser on
	service sendmailanalyser start


Caching output:
---------------
(or why you MUST use sa_cache)

When consulting CGI report, statistics are computed each time from the data
files. In day view it can be really speed but when you consult month or year
views it can take a very very long time.

This is why you have to run the cache script that will create Perl data files
for each days, months and years.

It will also help to reduce space disk usage by archiving or removing all data
file older than current month.
 

Install SendmailAnalyzer cache into CROND as follow:

	0 5 * * * /usr/local/sendmailanalyzer/sa_cache

The sa_cache program also read the DOMAIN_REPORT configuration directive and
compute cached statistics for each domain set in this directive. You no more
need to run sa_cache separately for each domain.

If you have huge messages per day you may run a daily cache every five minute
to prevent sa_cache and sa_report.cgi to go out of memory adding a cron job:

	*/5 * * * * /usr/local/sendmailanalyzer/sa_cache -a

with this setup you will have at worst a lag of five minutes in the reports.

Log rotate case
---------------

If you use real time mode and you have logrotate installed on you maillog
file you must restart SendmailAnalyzer each time logrotate is used.
To install it edit the /etc/logrotate.d/syslog file and add a line
in the postrotate part as follow:

/var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog {
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
	/PATH_TO/rc.sendmailanalyzer restart >/dev/null 2>&1 || true
	# or /etc/rc.d/init.d/sendmailanalyzer restart >/dev/null 2>&1 || true
    endscript
}

Configuration
-------------

The default path to configuration file is /etc/sendmailanalyzer.conf
To know how to configure your report read carefully the example, all
is explain in this file and in README

Sendmail Configuration
----------------------

There's no special configuration to do with sendmail, the default sendmail
LogLevel is 9, which roughly is equivalent to the syslog level info. With
SendmailAnalyzer you don't need to increase this log level, if you increase this
value you will have most of the debug messages detected as false rejection or
error.


