Date: Tue, 27 Feb 2001 10:26:49 -0500 From: Michael Lucas <mwlucas@blackhelicopters.org> To: Fernando Gleiser <fgleiser@cactus.fi.uba.ar> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: "if syslogd message appears, email immediately" program? Message-ID: <20010227102649.A37911@blackhelicopters.org> In-Reply-To: <Pine.LNX.4.21.0102271224550.12264-100000@mail.it.com.ar>; from fgleiser@cactus.fi.uba.ar on Tue, Feb 27, 2001 at 12:27:52PM -0300 References: <20010227100357.A37783@blackhelicopters.org> <Pine.LNX.4.21.0102271224550.12264-100000@mail.it.com.ar>
next in thread | previous in thread | raw e-mail | index | archive | help
Fernando,
I've tried this before, and wound up with a perl process that sucked
up megs of RAM. This system runs for months without rebooting.
Also, what happens when the log rotates?
On Tue, Feb 27, 2001 at 12:27:52PM -0300, Fernando Gleiser wrote:
> On Tue, 27 Feb 2001, Michael Lucas wrote:
>
> > Hello,
> >
> > I'm trying to find a program that watches syslogd continuously, and if
> > a certain daemon makes a log entry it sends an email.
> >
> > We need this in real time, so logsurfer (or any other cron process)
> > won't do it.
> >
> > Surely someone has written this before?
>
> You can do that with a 20-less lines perl script. It is something like:
>
> #!/usr/bin/perl -w
>
> open LOG, "tail -f yourlogfile |";
>
> while (<LOG>) {
>
> if ($_=~/putyourpatternhere/) {
> system ('mail -s "alarm !!" you@yourdomain');
> }
> }
>
> Hope this helps.
>
>
> Fer
>
>
> >
> > Thanks,
> > Michael
> >
> >
--
Michael Lucas
mwlucas@blackhelicopters.org
http://www.blackhelicopters.org/~mwlucas/
Big Scary Daemons: http://www.oreillynet.com/pub/q/Big_Scary_Daemons
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010227102649.A37911>
