<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
hi list,<br>
<br>
what's the best way with syslog-ng to control the number of syslog mail
notifications coming from a machine ?<br>
I'm currently using perl script to send notification but sometime it
just floods my mail (some 600 mails in 5 minutes for a single event)<br>
<br>
I want to rate limit it to only 1 mail in 5 minute per host or message.
<br>
<br>
<small>/etc/syslog-ng/syslog-ng.conf :<br>
-----------------------------<br>
<br>
[...]<br>
destination d_mail {<br>
program("perl /usr/local/bin/mail_log_mailsend.pl $MSG ");<br>
};<br>
<br>
[...]<br>
filter f_notify_by_mail {level(emerg,alert,crit); };<br>
<br>
[...]<br>
log { source(s_network); filter(f_notify_by_mail); destination(d_mail);
};<br>
<br>
mail_log_sendmail.pl<br>
--------------------<br>
use MIME::Lite;<br>
while (<>)<br>
{<br>
<br>
# $_ contains the Log<br>
my $body = "Mail from Syslog-ng $_ ";<br>
my $msg = MIME::Lite->new (<br>
From =>'<a class="moz-txt-link-abbreviated"
href="mailto:syslog-ng@my_domain.fr">syslog-ng@my_domain.fr</a>',<br>
To =>'<a class="moz-txt-link-abbreviated"
href="mailto:service.informatique@my_domain.fr">service.informatique@my_domain.fr</a>',<br>
Subject =>'[SYSLOG-NG] Avertissement',<br>
Type =>'multipart/related');<br>
<br>
$msg -> attach (Type => 'text/html',<br>
Data => qq {$body});<br>
<br>
MIME::Lite->send('smtp','imap', Timeout=>60);<br>
$msg -> send or die "Impossible to send mail!";<br>
<br>
}<br>
</small><br>
Is there's a notification_interval control (as i use in nagios) i can
add in my syslog config file ? I didn't found anything in the man page
(maybe i'm reading like a frog)<br>
Anyone have any clues / examples to show ?<br>
<br>
tks,<br>
<br>
julien Lecubin<br>
<pre class="moz-signature" cols="72">--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Julien LECUBIN
Institut de Mecanique Celeste et de Calcul des Ephemerides
CNRS UMR 8028 - Observatoire de Paris
77, avenue Denfert Rochereau
75014 PARIS
tel : 01.40.51.22.80
fax : 01.46.33.28.34
<a class="moz-txt-link-abbreviated" href="mailto:julien.lecubin@imcce.fr">julien.lecubin@imcce.fr</a> | <a class="moz-txt-link-abbreviated" href="mailto:service.informatique@imcce.fr">service.informatique@imcce.fr</a>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</pre>
</body>
</html>