[nylug-talk] can you redirect a socket
Tim Gales
Fri Aug 11 07:38:28 EDT 2006
Thanks (to all) for the responses. I guess I haven't overlooked some
mechanism that would work here.
Peter C. Norton wrote:
> On Thu, Aug 10, 2006 at 08:08:38PM -0400, Tim Gales wrote:
>> 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 realg ize 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)
>
> No, generally not. Syslog is not one of the greatest softwares ever
> written.
>
>> 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.
>
> Yeah, that'd work. That's a lot of chrooted apps, though. IMO you'd be
> better off, in a custom app, writing your own libsyslog that wraps
> openlog, closelog, etc. but also reads the desired syslog socket as a
> string from the environment and uses that for the open() call, and
> LD_PRELOAD that library for the apps that need it. It is a bit less
> configuration-heavy than having to chroot() everything. It should be
> straightfoward to write the openlog/closelog/syslog wrapper.
>
There are roughly six apps that need a more flexible logging setup.
So I am leaning towards just jailing them.
>> But I was wondering if there is a way to redirect an already
>> created socket and point it to another one.
>
> A symlink?
>
>> 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
>
> OK, the LD_PRELOAD solution should work.
>
>> I have the nagging feeling that I am misunderstanding something
>> fundamental about Linux based OS'S.
>
> Nah, you're running into the programming from a simpler age. Syslog is
> old, syslog is bad, but syslog is the way it's done. It will hopefully
> go away in the future now that there's less bogus talk about standards
> bodies being relevant, and more actual pedal to the metal "does this
> work as well as on linux/bsd/solaris" questions going on.
>
>> Any help would be appreciated.
>
> Let me know if you need more information.
>
> -Peter
>
--
T. Gales & Associates
'Helping People Connect with Technology'
http://www.tgaconnect.com
More information about the nylug-talk
mailing list