[syslog-ng]Question about file handles, programs and time_reopen

Mike Tremaine syslog-ng@lists.balabit.hu
Mon, 06 Dec 2004 10:50:00 -0800


On Sun, 2004-12-05 at 05:35, Balazs Scheidler wrote:
> > 
> > Same experiment with a program. Syslog-ng forks a child program at
> > start-up but what happens if that child dies. I did a kill -9 just to
> > see if it would detect the absence and try to re-fork. 
> > 
> > If I want these features do I need to look outside of syslog-ng [some
> > sort of daemon watcher that will throw a HUP].
> 
> you need a daemon watcher that restarts the program if it exited while
> keeping the stdin opened.

Thank you for answer. Let me ask a follow up. Do you think it would be
possible to catch that event and re-fork the program or re-open a file
handle in syslog-ng? I have not looked at the source code yet, that is
my next task. But I'm asking in a theoretical way since you are the one
who would know best.

Thanks again..


PS - I suppose this is why a named pipe is a preferred method since it
is more fault tolerant.

Just add more info I was doing something like this

destination d_mysql { program("/usr/bin/mysql -u user
--password='password' database" template("INSERT INTO logs (host,
facility, priority, level, tag, date, time, program, msg) VALUES (
'$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG',
'$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n")
template-escape(yes)); };


Instead of the standard method of using a pipe and have another process
read the pipe. This method is nice since you don;t have to worry about
restarting the reader if you restart syslog-ng.


-- 
Mike Tremaine
mgt@stellarcore.net
http://www.stellarcore.net