From owner-freebsd-questions Tue Feb 27 7:27:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from blackhelicopters.org (geburah.blackhelicopters.org [209.69.178.18]) by hub.freebsd.org (Postfix) with ESMTP id D0BF037B718 for ; Tue, 27 Feb 2001 07:27:14 -0800 (PST) (envelope-from mwlucas@blackhelicopters.org) Received: (from mwlucas@localhost) by blackhelicopters.org (8.9.3/8.9.3) id KAA37931; Tue, 27 Feb 2001 10:26:50 -0500 (EST) (envelope-from mwlucas) Date: Tue, 27 Feb 2001 10:26:49 -0500 From: Michael Lucas To: Fernando Gleiser Cc: freebsd-questions@FreeBSD.ORG Subject: Re: "if syslogd message appears, email immediately" program? Message-ID: <20010227102649.A37911@blackhelicopters.org> References: <20010227100357.A37783@blackhelicopters.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: ; from fgleiser@cactus.fi.uba.ar on Tue, Feb 27, 2001 at 12:27:52PM -0300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 () { > > 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