Difference between revisions of "Monitor System Logs via E-mail"

From Amahi Wiki
Jump to: navigation, search
m
Line 4: Line 4:
 
{{Code|yum install logwatch}}
 
{{Code|yum install logwatch}}
  
* You can customize the settings by adding options to '''''/etc/logwatch/logwatch.conf'''''.  by default it sends the daily logwatch email to the local root mail folder.  If you want to forward these emails to another (including external) account, see [http://wiki.amahi.org/index.php/Forward_System_Emails Forward System Emails]
+
* You can customize the settings by adding options to '''''/etc/logwatch/logwatch.conf'''''.  by default it sends the daily logwatch email to the local root mail folder.  If you want to forward these emails to another (including external) account, see [http://wiki.amahi.org/index.php/Forward_System_Emails Forward System Emails] and this add this line:
 
 
* If you want to send the logwatch emails to an address different from other root emails, add this line:
 
 
{{Text|MailTo <nowiki>=</nowiki> (your email address)}}
 
{{Text|MailTo <nowiki>=</nowiki> (your email address)}}
  

Revision as of 15:43, 13 August 2011

This will provide the capability to receive system logs via e-mail. There are many customizable features (Logwatch Documentation), but this will only identify the basic ones.

  • First, open a terminal window and become root. Enter the following to install:
bash code
​yum install logwatch​


  • You can customize the settings by adding options to /etc/logwatch/logwatch.conf. by default it sends the daily logwatch email to the local root mail folder. If you want to forward these emails to another (including external) account, see Forward System Emails and this add this line:
Text
​MailTo = (your email address)​
  • To test, enter the command logwatch and go check your email. If you want the email in html, add this line:
Text
​Output = html​
  • Ensure sendmail is running (service sendmail status) or it won't work.

Optional:

  • These are a few more basic options that can be configured.
    • Range = yesterday (line 65) - additional values are all or today.
    • Detail = Low (line 72) - 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.