This will provide the capability to receive system logs via e-mail. There are many customizable features , but this will only identify the basic ones.
REF: Logwatch
- First, open a terminal window and become root. Enter the following to install:
bash code
|
sudo apt-get install logwatch
|
- There are some additional steps needed for Ubuntu to work correctly:
bash code
|
sudo mkdir /var/cache/logwatch sudo cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/
|
- You can customize the settings by adding options to /etc/logwatch/conf/logwatch.conf. If you want the log in email vs screen output, change this line read:
- By default it sends the daily logwatch email to the local root mail box. To change it, edit this line (change user@yourisp.com to desired email address) to read:
Text
|
MailTo = user@yourisp.com
|
- If you want the email in html vs text, change this line to read:
- To test, enter the command logwatch and go check your email.
bash code
|
sudo logwatch
|
- Ensure sendmail or postfix is running (rerun command and change status to start if not):
bash code
|
service sendmail status
|
or
bash code
|
service postfix status
|
Optional:
- These are a few more basic options that can be configured.
- Range = yesterday (default) - additional values are all or today.
- Detail = Low (default) - additional values are med or high. I set mine to med.
This application runs transparent in the background, once daily in the morning. If you want to run it more frequently (i.e. send logs for today), then change the range and execute the command logwatch as needed.
NOTE: If you want to forward these emails to another (including external) account, see Forward System Emails.