To watch the logs and send alert periodically to admin by configuring logwatch.
Install Logwatch using
# sudo apt-get install logwatch
Edit logwatch.conf file
Change the following:
# Output = mail
# Format = html
# MailTo = user@https://https://https://https://www.https://https://https://www.https://linuxsysadmins.com/
Save and exit wq!
Edit the file 00logwatch to append the mail were we need to get the Logs
Add the following line.
# /usr/sbin/logwatch –mailto firstname.lastname@example.org
# /usr/sbin/logwatch –mailto email@example.com
Save and exit.
Test the Logwatch using command
If we need to get log in specific time add in cronjob as below
Create a Cronjob using
Append the Below Content
# m h dom mon dow command
0 10 * * * /usr/sbin/logwatch
That’s it we have done with log watch configuration.