Re: [squid-users] squid logging to syslogd

From: Colin Campbell <sgcccdc@dont-contact.us>
Date: Fri, 8 Mar 2002 08:24:21 +1000 (EST)

Hi,

On Thu, 7 Mar 2002, Deb wrote:

>
> Got the logging working - but the results are not what we need...

        [snip]

> What I need to to get ALL logging, including that which goes into the
> store.log and access.log to be redirected to syslogd.
>
> Is this possible?

A quick 'grep syslog *.c' in the src directory shows syslog() only being
called in main.c (mostly around fork()s), in tools.c (in fatal_common())
and in debug.c. Without code modification what you want isn't going to
happen.

You might be able to get it to work by setting the log files to, eg a
named pipe and have something read that pipe and syslog its input. Since
squid is single threaded this shouldn't be too hard. A quick perl script
or even something like

        #! /bin/sh

        # create fifo and change to be owned by squid
        LOGPIPE=/squid/logs/pipe
        test -p $LOGPIPE || mkfifo $LOGPIPE
        chown nobody:nogroup $LOGPIPE

        # need loop cos logger exits with every read
        while true; do
                logger -f $LOGPIPE -p local4.notice -t squid
        done

might do the trick. bear in mind though that this might be a bottleneck
and that syslog might not be guaranteed to log everything sent to it.

Colin
Received on Thu Mar 07 2002 - 15:24:35 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:06:47 MST