Difference between revisions of "Monitor System Logs via E-mail"
From Amahi Wiki
Line 2: | Line 2: | ||
* First, open a terminal window and become '''root'''. Enter the following to install: | * First, open a terminal window and become '''root'''. Enter the following to install: | ||
− | {{Code|yum install logwatch}} | + | <blockquote>{{Code|yum install logwatch}}</blockquote> |
* 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 box. To change it, add this line: | * 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 box. To change it, add this line: | ||
<blockquote>{{Text|MailTo <nowiki>=</nowiki> (your email address)}}</blockquote> | <blockquote>{{Text|MailTo <nowiki>=</nowiki> (your email address)}}</blockquote> | ||
Line 10: | Line 10: | ||
* To test, enter the command '''''logwatch''''' and go check your email. | * To test, enter the command '''''logwatch''''' and go check your email. | ||
− | + | <blockquote>{{Code|logwatch}}</blockquote> | |
− | * Ensure sendmail is running | + | * Ensure sendmail is running or it won't work (change status to start if it is not): |
+ | <blockquote>{{Code|service sendmail status}}</blockquote> | ||
'''Optional:''' | '''Optional:''' |
Revision as of 15:48, 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 box. To change it, add this line:
Text MailTo = (your email address)
- If you want the email in html, add this line:
Text Output = html
- To test, enter the command logwatch and go check your email.
bash code logwatch
- Ensure sendmail is running or it won't work (change status to start if it is not):
bash code service sendmail 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.