Sending an email notification when syslog goes down

Hi

All of a sudden the syslog daemon in the server went down and then later I started it manually

# ps -ef | grep syslogd
root 217228 114906 0 Nov 16 - 0:00 /usr/sbin/syslogd
root 430306 290870 0 14:18:11 pts/0 0:00 grep syslogd

Can some one help me with a script which will monitor the syslog continuously and will email me automatically if in case it goes down by any chance

assuming you configured your system to send mails from command line:

ps -ef | grep "[/]usr/sbin/syslogd" >/dev/null 2>&1 || echo "syslog down on host $(hostname)" | mail -s "syslog down" youremail@domain
1 Like

two ways all i know
run a cron job every minute or run a script which sleeps for time interval you want to check the syslog service
in script you can check the status of syslog service if the status is running every thing is fine else make it send an alert (email)