Configure LogWatch for weekly email and HTML output format

If you wish to receive logwatch’s report on a weekly basis instead of daily you have two perform two basic tasks.

First, edit /etc/logwatch/conf/logwatch.conf and change:

Range = yesterday


Range = between -7 days and -1 days

Also, to enable the HTML output, change:

Format = text


Format = html

Second, move the cron script from the daily directory to the weekly directoru with this command:

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

Testing LogWatch and fixing missing files

Before quitting test the scripts because there are two common problems that usually occurs.

Run /etc/cron.weekly/00logwatch  and check the output.

Problem 1: missing perl library

On some system you need to install the perl-DateManip library otherwise LogWatch will not understand the “Range” config directive.

If this happen on your system just install the perl library with the command:

apt-get install libdate-manip-perl

Problem 2: missing HTML templates

Since we enabled HTML output then LogWatch will look for an header and footer HTML template, if those files are not shipped with your distribution and if you get an error message about it then you have to manually create them.

Create the directory:

mkdir /usr/share/logwatch/default.conf/html/

After that you can create into this directory the two html templates.

As example you can use the following code for footer.html template:


And the following one for the header.html template:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">
<title>Logwatch  $Version  ( $VDate )</title>
<meta name="generator" content="Logwatch  $Version ( $VDate )">
<style type="text/css">
h1 {color: gray; border-bottom: 3px double silver}
h2,h3 {color: gray; border-bottom: 1px solid silver}
.ref {padding-left: 1%}
.service {padding-left: 1%; font-family: Monospace}
.return_link {border-top: 1px; border-bottom: 1px;
padding: 1%; margin-top: 1%; margin-bottom: 1%;}
.copyright {color: black; border-top: 1px solid grey;
        border-bottom: 1px solid grey;
padding: 1%; margin-top: 1%; margin-bottom: 1%;}
<body style="width:90%; margin-left: 5%; margin-right: 5%" bgcolor="#FFFFFF">
Configure LogWatch for weekly email and HTML output format, 4.0 out of 5 based on 1 rating

Potrebbe interessarti anche:

Iscriviti alla newsletter

  • HowTo e Tutorial su Linux e Ubuntu
  • Wordpress, Perl & Webmin
  • VoIP, Asterisk, SIP

Antonio Gallo is a Linux entusiast and evangelists since 1996 when he started the Bad Penguin project. Notably he was in the board and sysadmin of for many years and also managed the "Linux Day" event in Italy, wrotes for technical magazines. Antonio writes, codes and develops Linux and Open Source software solutions. When everybody else fails he's the man to be called: bash, awk, php, perl, C are the rabbits in his cylinder ready to spread the Linux magic around the world.