[nylug-talk] can you redirect a socket

Tim Gales
Thu Aug 10 20:08:38 EDT 2006


I have question:

Is there a way to redirect an already created socket
(on a per process basis)?

Let me explain a little.

We are running on a Red Hat enterprise box which has syslog running.
Some applications written in C want to send their error/messages to 
syslog-ng instead of the system logger.

We have built a syslog-ng 2.O RC which is working.
The syslog-ng has a conf file which creates a ~/dev/log.
logger -u /home/user/dev works and life is good.

But when I look at the man page for openlog (as called by a C program),
I don't see an option which allows pointing to a non-standard socket. 
And this seems like there is no way to pick which logger you want to
speak to from a C program. (I realize this is probably a little unusual 
because syslog-ng seems to have been engineered as a replacement for 
syslogd -- and was not intended to be run side-by-side)

One idea that springs to mind it trying to chroot the C apps
so that they will be jailed to syslog-ng and when they write to
/dev/log it will be syslog-ng's socket.

But I was wondering if there is a way to redirect an already
created socket and point it to another one.

What I would like to do is be able to, on a per process basis,
send messages to either the system logger or syslog-ng

I have the nagging feeling that I am misunderstanding something
fundamental about Linux based OS'S.

Any help would be appreciated.


-- 

T. Gales & Associates
'Helping People Connect with Technology'

http://www.tgaconnect.com


More information about the nylug-talk mailing list