Logwatch is a wonderfull Linux tool that informs us (by email if you like) to what happened to a server during the previous day (configurable).
EDIT: I’ve just tried with CentOS 6.3 minimal install, with the default mirrors configured and logwatch (yum install logwatch) installed just perfectly.
In CentOS 6, there’s a problem installing it (at least in all my servers with CentOS 6 i had it) because of perl-Date-Manip, with the error:
http://mirrors.nfsi.pt/CentOS/6.2/os/i386/Packages/perl-Date-Manip-6.24-1.el6.noarch.rpm: [Errno -1] Package does not match intended download.
I guess it’s because of the version…
The solution: Get perl-Date-Manip-5.54-4.el6.noarch.rpm from the internet (ie rpm.pbone.net) and before installing it, install all it’s dependencies.
NOTE: This version is i686. For x86_64 just replace the arch.
Before installing, install all it’s dependencies:
yum install mailx perl perl-Module-Pluggable perl-Pod-Escapes perl-Pod-Simple perl-YAML-Syck perl-libs perl-version
And then, install perl-Date-Manip that we have downloaded before:
rpm -ivh perl-Date-Manip-5.54-4.el6.noarch.rpm
and next, we can install logwatch:
yum install logwatch
This way, logwatch is installed
If you want to have logwatch mailed to you, you need to install sendmail (or postfix). According to logwatch.conf, only sendmail (and mailers that support output stream) can be used
# By default we assume that all Unix systems have sendmail or a sendmail-like system. # The mailer code Prints a header with To: From: and Subject:. # At this point you can change the mailer to any thing else that can handle that output # stream. TODO test variables in the mailer string to see if the To/From/Subject can be set # From here with out breaking anything. This would allow mail/mailx/nail etc….. -mgt
yum install sendmail
Configuring the email address
Now, we have two choices – or we just put our email address in logwatch configuration file – or we put it in /etc/aliases, thus receiving all email to root from the system. The latter is better, since we catch all email from our system.
Go to line 96, uncomment the line (remove the ‘#’) and change the name to your email address:
# Person who should get root’s mail
Save and run:
and you can see how things are going by watching /var/log/maillog
tail -f /var/log/maillog
Note: If you get an error because of Perl-Date-Manip and the timezone, that’s a problem and i couldn’t find a solution.