UNIX / How to configure Logwatch on Redhat systems

Home | UNIX | Practical

How to configure Logwatch on Redhat systems


Base configuration
Configure logwatch,
vi /etc/logwatch/conf/logwatch.conf
for example,
LogDir = /var/log
TmpDir = /var/cache/logwatch
MailTo = root
MailFrom = Logwatch
Print = No
Range = yesterday
Detail = High
Service = All
#Service = "-zz-network"
#Service = "-zz-sys"
Service = "-eximstats"
mailer = "sendmail -t"


HTML output and template
Note Redhat RHEL 5.1 logwatch is broken about that. Use RHEL 5.2's logwatch package or superior.

Change logwatch reports's output to html,
vi /etc/cron.daily/0logwatch
or the same,
vi /usr/share/logwatch/scripts/logwatch.pl
for example,
$Config{'output'} = "html";

Edit the template
vi /usr/share/logwatch/default.conf/html/header.html
for example,
<html>
<head>
<title>stream.nethence.com</title>
<style type="text/css">
* { font-size:10px; font-family:Arial,Verdana }
td { border:0 }
h1 { font-size: 150%; margin-bottom:0; padding-bottom:0 }
h2 { font-size:135%; margin-bottom:0; padding-bottom:0 }
h3 { font-size:120%; margin-bottom:0; padding-bottom:0 }
</style>
</head>
<body>
<h1>stream.nethence.com</h1>
<p>    <i>Logwatch $Version ($VDate)</i></p>
<hr>
<!-- End header.html -->
and,
vi /usr/share/logwatch/default.conf/html/footer.html
for example,
<!-- Start footer.html -->
</body>
</html>

You'll also want to fix table borders,
vi /etc/cron.daily/0logwatch
or the same,
vi /usr/share/logwatch/scripts/logwatch.pl
for example,
<table>



Sat Nov 8 12:19:49 CET 2008
       © 2008 Pierre-Philipp Braun