Installing logwatch on Debian 10

Unless something is wrong, you don’t actively browse through your server logs. But how do you know something’s wrong? Logwatch serves you handy summaries of your logs.

Installing logwatch on Debian 10

I strongly advise you to set up msmtp or any other mail transfer agent on your server. Without it, Logwatch will not send you the handy report.

Installation

Logwatch is available in the standard Debian repositories.

$ sudo apt install --no-install-recommends logwatch

On my system, this installs libgdbm-compat4 libgdbm6 libperl5.28 logwatch perl perl-modules-5.28.

Configuration

First copy the default config template to the configuration directory.

$ sudo cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/

Next, edit the file.

sudo nano /etc/logwatch/conf/logwatch.conf

# find and change these lines:
Output = mail
Format = html

# set to one of the recepient as in /etc/aliases or use an e-mailaddress
MailTo = root

Finishing up

You can test Logwatch by issuing the following command:

sudo /usr/sbin/logwatch

If this error pops up

/var/cache/logwatch No such file or directory at /usr/sbin/logwatch line 643.

then create the cache directory yourself.

sudo mkdir /var/cache/logwatch

Test again


Binoculars image by Josh Holloway from Pixabay

Bert Melis's Picture

About Bert Melis

My name is Bert Melis. I'm a reliability engineer by profession and a IoT enthusiast by heart. I try to make my small home smart without spending too much money.