Member-only story
System That Every Day Automatically Sends Log Files From the Server
Introduction
A log monitoring tool that can be used on Linux is logwatch. By using logwatch, you can send the analyzed log by e-mail at a fixed time every day.
It’s very easy to set up, install it, specify your email address and you’re done.
Logwatch install
Sendmail is required to run logwatch, so if it is not installed, please install it as appropriate.
root@vagrant:/home/vagrant# apt-get install sendmail logwatch -y
Next copy the default settings to /etc/logwatch/conf/logwatch.conf
.
root@vagrant:/home/vagrant# cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/logwatch.conf
Edit /etc/logwatch/conf/logwatch.conf
to set the contents of the report.
The important thing is MailTo and MailFrom, where you put the destination and sender’s email addresses.
Detail="High"
You can make the log more detailed by setting.Range
You can specify the period of the log to be sent with.