How to pipe varnishncsa entries?

Rowan @ Jetboy rowan at jetboy.co.uk
Wed Nov 14 14:16:41 CET 2012


 Ubuntu 12 x64 Server, Varnish 3

I have varnishncsa happily logging away to itself with the following in
/etc/default/varnishncsa

DAEMON_OPTS="-a \
             -c \
             -D \
             -F '%{Host}i %{X-Forwarded-For}i %h %l %u %t \"%r\" %s %b
\"%{Referer}i\" \"%{User-agent}i\"' \
             -m 'TxHeader:Server: Varnish/3' \
             -P ${PIDFILE} \
             -w /var/log/varnish/varnishncsa.log"

and by changing:

    if start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
        --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
        > ${output} 2>&1; then

to:

    if bash -c "start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
        --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
        > ${output} 2>&1"; then

in /etc/init.d/varnishncsa to allow the sending of parameters with
whitespace in from DAEMON_OPTS.

In *addition* to logging locally, I'd like to pipe the same custom format
log entries to syslog for remote centralised logging, using this pipe:

|/usr/bin/logger -t varnishncsa.log -p local0.info

Is this possible? If so, how? Ideally I'd like the command within
DAEMON_OPTS, but my efforts so far haven't resulted in any output to syslog.
I'm already successfully using a version of the same pipe to put Apache logs
to syslog.




More information about the varnish-misc mailing list