LINUX : Install Logwatch on ubuntu

Install Logwatch :

Issue the following command to install Logwatch along with Postfix:

apt-get install postfix logwatch

Be sure to select the “Internet Site” configuration when installing Postfix.
Configure Logwatch Link

Once you have installed Logwatch, you will need to configure it to email you the reports it generates. You are encouraged to look through the entire configuration, but you may safely use Logwatch after editing the lines below.

File: /usr/share/logwatch/default.conf/logwatch.conf

LINE 35
Output = mail
LINE 37
Format = html
LINE 44
MailTo = <validemail >@mydomain.com
Add this line
MailFrom = logwatch@mydomain.com

These directives tell Logwatch to email you reports in an HTML format. The MailTo and MailFrom directives should be valid email addresses.

Issue the following command to test your logwatch installation:

logwatch

Once you have issued this command, you will need to check your email to make sure that logwatch is working. Be sure to check your spam folder as these emails may be seen as spam.

Adding a Cron Job for Logwatch Link
You can add a cron job for Logwatch in order to receive daily emails of new reports. You can add a new entry to your crontab by running

crontab -e

The following example cron job runs Logwatch at 1 AM each day, issuing you an email report of the daily activity:

# m h dom mon dow command
0 1 * * * /usr/sbin/logwatch

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.