Koozali.org: home of the SME Server

Notification of specific log entries

Offline AJB

  • 17
  • +0/-0
Notification of specific log entries
« on: December 29, 2007, 07:28:30 PM »
Hi all,

Not sure I'm posting this in the right forum; if not, let me know. My question is basically how to configure email alerts in case a specific entry gets written into the log.

The situation: I'm using a Compaq Proliant 1600 configured with hardware RAID5 using a Smart Array 3200 Controller and running SME 7.2. When one of the discs fails, the line

Code: [Select]
[date/time] [hostname] kernel: Non Fatal error on ida/c0d0
is written into the Messages log file. And while I can manually check for occurence of this entry, it would be neat if the admin would receive an email notification whenever this entry is written into the log.

I have installed LogWatch in my attempts to get this working, but the default LogWatch-config does not include the entry in its notification mail. Adjusting the Detail level to 10 did not help either.

Could anyone help me with getting this to work, either with or without LogWatch? Oh, and I have been somewhat of a Windows guy till now and I usually administer my SME box through the server manager. So although I'm not exactly afraid of the cli, I'm not all that comfortable with it either. A step-by-step approach would therefore be highly appreciated ;)

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Notification of specific log entries
« Reply #1 on: December 30, 2007, 12:47:24 AM »
Not sure I'm posting this in the right forum; if not, let me know. My question is basically how to configure email alerts in case a specific entry gets written into the log.

SME server has no feature for configuring email alterts base on log entries.

I see you have installed LogWatch. I expect that can do the job for you if configured correctly. Correct configuration of LogWatch, however, is off-topic for this forum.

Offline AJB

  • 17
  • +0/-0
Re: Notification of specific log entries
« Reply #2 on: December 30, 2007, 01:17:03 AM »
I see. Any chance that such functionality might be included in future releases of SME Server? It seems quite useful to me, but I am somewhat biased of course...

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Notification of specific log entries
« Reply #3 on: December 30, 2007, 11:29:15 AM »
I see. Any chance that such functionality might be included in future releases of SME Server? It seems quite useful to me, but I am somewhat biased of course...
If you would like it considered for future releases you should add it as a New Feature Request in the bugtracker.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline brianr

  • *
  • 988
  • +2/-0
Re: Notification of specific log entries
« Reply #4 on: December 30, 2007, 12:33:14 PM »
suggest you go to here, you may find what you want.

http://www2.logwatch.org:81/tabs/docs/HOWTO-Customize-LogWatch.html

Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Online Stefano

  • *
  • 10,839
  • +2/-0
Re: Notification of specific log entries
« Reply #5 on: December 30, 2007, 03:36:57 PM »
hi

a simple script such as
Code: [Select]
#/bin/sh

DATE=`date -d yesterday +"%b %e"`

grep "$DATE" /var/log/messages | grep -i 'non fatal error'

in etc/cron.daily will send you an email if an error occurred

probably you'd better to put in /etc/cron.d and run BEFORE cron.daily, because of logs rotation.

HTH

ciao
Stefano

Offline AJB

  • 17
  • +0/-0
Re: Notification of specific log entries
« Reply #6 on: December 30, 2007, 09:37:34 PM »
Thanks!

I'm not using your exact script as it did not entirely work (probably because I've been fooling around with the date on my test box for various reasons which likely screwed up the logs), but once Google taught me the basics of your script, I downgraded it to a simple grep through /var/log/messages which also does the trick. I should really get into scripting and all sorts of other non-gui stuff myself ;).

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Notification of specific log entries
« Reply #7 on: December 30, 2007, 09:41:36 PM »
Moving this topic to the SME 7.x contribs forum, it is more appropriate there. Thanks!
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline AJB

  • 17
  • +0/-0
Re: Notification of specific log entries
« Reply #8 on: December 30, 2007, 10:08:15 PM »
Not sure if I'm supposed to second-guess the moderating team in the thread itself, but it seems to me that this thread is not related to any contrib. My attempts to set this up started with LogWatch, but as it is I managed to configure notifications without it, using only a bash script and cron.

Don't mean to offend anyone, so please remove this post if not appropriate.