[syslog-ng]destination { program(); } failures...

David Douthitt ssrat@mailbag.com
Tue, 05 Jun 2001 11:38:02 -0500


"A.L.Lambert" wrote:
> 
> > destination { program(/usr/bin/notify); };
> >
> > This works better, but only seems to work when it starts up, but not
> > thereafter.  /usr/bin/notify is a /bin/sh script.
> >
> > Does this just not work in v1.4.10??  It's getting rather frustrating.
> >
> > I'm running in Red Hat Linux 6.2 without all the bells and whistles
> > (like X).  I'd *REALLY* like to get this to work - it's one of the big
> > draws to syslog-ng for me.
> 
>         I would guess that the shell script should look like this:
> --cut--
> #!/bin/sh
> 
> while read line ; do
> # stuff to do, presumably pager, or email or some such.
> done
> --cut--
> 
>         Syslog-ng (IIRC), will open up a pipe to the script/program in
> question, and feed it stuff on STDIN.  I don't think it re-executes the
> program with each message.  I may be totally wrong, your mileage may vary,
> etc.  Cheers!

The script is this:

#!/bin/sh

# notify: send a page via email

PAGER=${PAGER:-<mypagebyemail>}

if [ $# -gt 0 ] ; then
	/bin/mail $PAGER <<!*
$(echo $@)
!*
else
	while read LINE ; do
		/bin/mail $PAGER
	done
fi

...this doesn't work reliably from syslog-ng 1.4.10 ...

PS: Now if I could just hit "Reply" to answer back to the list.....