Nethence Documentation Lab Webmail Your IP BBDock  


Those documents are obsolete, please use the Nethence Documentation instead.

HomeUnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigsPrivate

Daily mail reports with logwatch
 
http://pbraun.nethence.com/doc/sysutils_linux/redhat.html
http://pbraun.nethence.com/doc/sysutils_linux/redhat_packages.html
http://pbraun.nethence.com/doc/sysutils_linux/logwatch.html
http://pbraun.nethence.com/doc/sysutils/log_rotation.html
 
 
Basic configuration
Configure logwatch,
cd /usr/share/logwatch/default.conf
mv logwatch.conf logwatch.conf.dist
sed '/^$/d; /^#/d;' logwatch.conf.dist > logwatch.conf
change/comment,
Detail = High
#Service = "-zz-network" # Prevents execution of zz-network service
#Service = "-zz-sys" # Prevents execution of zz-sys service
Note. we prefer to edit the defaults instead if local configs (/etc/logwatch/conf/logwatch.conf) as we couldn't comment some services on the latter.
Note. those perl modules are required to get CPU and mem info,
perl -MCPAN -e 'install Sys::CPU'
perl -MCPAN -e 'install Sys::MemInfo'
 
 
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
change,
$Config{'output'} = "html";
Note. that cron is a symlink to "/usr/share/logwatch/scripts/logwatch.pl"
 
Edit the template,
cd /usr/share/logwatch/default.conf/html
mv header.html header.html.dist
vi header.html
like,
<html>
<head>
<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>
<!-- End header.html -->
note. no espaces in from of doublequotes here, despide the default html code
note. we don't need title no h1, the hostname will appear in message's subjet anyway
and,
mv footer.html footer.html.dist
vi footer.html
like,
<!-- Start footer.html -->
</body>
</html>
 
You'll also want to fix table borders,
vi /etc/cron.daily/0logwatch
change this line,
<table border=\"1\"> ";
to,
<table> ";
 

Last update: Sep 27, 2010