Linux / UNIX Tech Support Forum
This is a discussion on Shell script to monitor syslog.log within the Shell scripting forums, part of the Development/Scripting category; Hi, I'm new to shell scripting. I need to monitor syslog.log hourly and alert us if there is any “error” ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi, I'm new to shell scripting.
I need to monitor syslog.log hourly and alert us if there is any “error” in the log for the previous hour. Can any one help in this regard. Thannks in Advance |
| Sponsored Links | ||
|
|
|
||||
|
You can use something as follows from a command line:
Code:
egrep -w 'error|warn|critical|fail' /var/log/syslog.log>/dev/null && echo "Error found" || echo "No error found" Code:
#!/bin/bash
warn_us(){
echo 'Error found' | mail -s 'Error' you@example.com
}
egrep -w 'error|warn|critical|fail' /var/log/syslog.log>/dev/null && warn_us
Code:
@hourly /path/to/above/script.sh
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| /var/log/syslog.log , egrep , email , mail , monitor syslog.log hourly , syslog |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MYSQL master-master replication monitor shell script | zafar466 | Databases servers | 4 | 08-05-2009 11:35 PM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 29-07-2008 10:22 AM |
| Syslog-ng Documentation | kvsmanean | Ubuntu / Debian | 1 | 13-06-2008 01:20 PM |
| Script to monitor a particular directory and send out e-mail.... | nageshms | Shell scripting | 1 | 11-02-2008 02:01 PM |
| Shell script to monitor remote local http or port 80 | amigo28 | Shell scripting | 1 | 12-02-2007 09:58 PM |