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

From Amahi Wiki
Jump to: navigation, search
(Use logwatch to monitor system status)
Line 1: Line 1:
'''NOTE:'''  This is not working correctly at the momentGuidance will be revised soon.
+
This will provide the capability to receive system logs via e-mailThere are many customizable features ([http://www.logwatch.org/tabs/docs/HOWTO-Customize-LogWatch.html/ Logwatch Documentation]), but this will only identify the basic ones.
  
 +
* First, open a terminal window and become '''root'''.  Enter the following to install:
 +
  yum install logwatch
  
This will provide the capability to receive system logs via e-mail.  This applies to Fedora 9 & 10.  There are many customizable features ([http://www.logwatch.org/tabs/docs/HOWTO-Customize-LogWatch.html/ Logwatch Documentation]), but this will only identify the basic ones.
+
* Settings are stored in '''''/usr/share/logwatch/default.conf/logwatch.conf''''' and NO changes to make it work. However, 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:
  
* First, open a terminal window and become '''root'''. Enter the following to install:
+
http://wiki.amahi.org/index.php/Forward_System_Emails
  yum install logwatch
 
  
* Settings are stored in '''''/usr/share/logwatch/default.conf/logwatch.conf''''' and require minor changes to make it work.  Use your favorite editor (mine is nano) and make the following change:
+
* If you want to send the logwatch emails to an address different from other root emails, edit the default.conf file with your favorite editor and make the following change:
 
** '''MailTo = root''' (line 35) to '''MailTo = (your email address)'''
 
** '''MailTo = root''' (line 35) to '''MailTo = (your email address)'''
  
* Ensure sendmail is started ('''''service sendmail start''''') or it won't work.
+
* Ensure sendmail is running ('''''service sendmail status''''') or it won't work.
  
* to have sendmail start at every boot enter as root '''''/sbin/chkconfig sendmail on''''', otherwise you will have to manually start sendmail after a reboot or power loss.
 
 
* To test, enter the command '''''logwatch''''' and go check your email.
 
* To test, enter the command '''''logwatch''''' and go check your email.
  

Revision as of 14:44, 23 November 2010

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:
 yum install logwatch
  • Settings are stored in /usr/share/logwatch/default.conf/logwatch.conf and NO changes to make it work. However, 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

  • If you want to send the logwatch emails to an address different from other root emails, edit the default.conf file with your favorite editor and make the following change:
    • MailTo = root (line 35) to MailTo = (your email address)
  • Ensure sendmail is running (service sendmail status) or it won't work.
  • To test, enter the command logwatch and go check your email.


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.