Logwatch: once a week is enough

If you administer Linux systems, it’s a pretty good idea to keep an eye on the logs. A handy tool that parses your system’s logs and sends you an email report is well known logwatch. By default it sends daily log reports. But to me this is too often. I want weekly reports.

This is how I achieved this on Centos 5.

If they’re not already installed, install logwatch and perl-DateManip

sudo su -
yum install logwatch perl-DateManip

Add a few options to logwatch.conf (I also like my output formatted in html)

echo "Range = between -7 days and -1 days" >> /etc/logwatch/conf/logwatch.conf
echo "Output = html" >> /etc/logwatch/conf/logwatch.conf

By default logwatch installs itself in /etc/cron.daily, you should move it to /etc/cron.weekly

mv /etc/cron.daily/0logwatch /etc/cron.weekly

You can now run a test logwatch and check if it arrives:

/etc/cron.weekly/0logwatch
This entry was posted in Howtos. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>