varnishncsa -F question
Mit Rowe
mit at stagename.com
Tue Oct 4 20:36:53 CEST 2011
Thanks Olivier,
For the FreeBSD startup script i'm now using...
#!/bin/sh
#
# $FreeBSD: ports/www/varnish/files/varnishncsa.in,v 1.4 2010/03/27 00:15:19
dougb Exp $
#
# PROVIDE: varnishncsa
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable varnishncsa:
#
# varnishncsa_enable="YES"
#
# Configuration variables and their default values:
#
# varnishncsa_pidfile - full path to the PID file.
# default: "/var/run/varnishncsa.pid"
#
# varnishncsa_file - full path to the log file.
# default: "/var/log/varnishncsa.log"
#
# varnishncsa_flags - command line arguments.
# default: "-D -P ${varnishncsa_pidfile} -a -c -w ${varnishncsa_file}"
#
# Add the following line to /etc/newsyslog.conf to rotate the log file
# once a day:
#
# /var/log/varnishncsa.log 640 7 * @T00 JB /var/run/varnishncsa.pid
#
# See varnishncsa(1) for a detailed overview of command-line options.
#
. /etc/rc.subr
name="varnishncsa"
rcvar=`set_rcvar`
command="/usr/local/bin/${name}"
# read configuration and set defaults
load_rc_config ${name}
: ${varnishncsa_enable:="NO"}
: ${varnishncsa_pidfile:="/var/run/${name}.pid"}
: ${varnishncsa_file:="/var/log/varnish/${name}.log"}
: ${varnishncsa_format:='%h %l %u %t \"%r\" %s %b \"%{Referer}i\"
\"%{User-agent}i\"'}
: ${varnishncsa_flags:="-P ${varnishncsa_pidfile} -D -a -c -w
${varnishncsa_file} -F \"${varnishncsa_format}\""}
pidfile=${varnishncsa_pidfile}
run_rc_command "$1"
On Tue, Oct 4, 2011 at 12:44 PM, Olivier <viapanda at gmail.com> wrote:
> You may want to read this:
>
> http://stackoverflow.com/questions/1661193/start-stop-daemon-quoted-arguments-misinterpreted
>
> As far as having Ubuntu script behave, you may try something in the line
> of:
> DAEMON_OPTS="-a -c -w ${LOGFILE} -D -P $PIDFILE"
> TRIX="-F %t %h \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"
> %{ncsa-start}i %{ncsa-end}o"
>
> start_varnishncsa() {
> .........
> --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} "${TRIX}" \:
>
>
>
> Best,
>
> - Olivier
>
>
> 2011/10/4 Mit Rowe <mit at stagename.com>:
>
> > The trouble comes with me using a start-up script and quotes.
> > For example, /usr/local/etc/rc.d/varnishncsa
> > . /etc/rc.subr
> > name="varnishncsa"
> > rcvar=`set_rcvar`
> > command="/usr/local/bin/${name}"
> > load_rc_config ${name}
> > : ${varnishncsa_enable:="NO"}
> > : ${varnishncsa_pidfile:="/var/run/${name}.pid"}
> > : ${varnishncsa_file:="/var/log/${name}.log"}
> > : ${varnishncsa_flags:="-P ${varnishncsa_pidfile} -D -a -c -w
> > ${varnishncsa_file}"}
> > pidfile=${varnishncsa_pidfile}
> > run_rc_command "$1"
> >
> > if i stick a -F at the end of varnishncsa_flags that contains ""
> > characters I get "unterminated quoted string" errors. I've tried
> > combinations of ', ", \", \' and so forth and haven't yet found the right
> > method.
> > Same thing happens with ubuntu's startup scripts.
> > Anyone have a suggestion to resolve this, at least starting with the
> default
> > format?
> > %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"
> >
> >
> >
> >
> > On Fri, Sep 2, 2011 at 2:26 PM, Jacques <whshub at gmail.com> wrote:
> >>
> >> I think I'm missing something. We use the following without problem on
> >> 3.0.1
> >> varnishncsa -F '%{X-Forwarded-For}i %l %u %t "%r" %s %b "%{Referer}i"
> >> "%{User-agent}i" "%{Cookie}i" "%{Varnish:hitmiss}x"' -X
> >> 'pingdom$|\.png$|\.ico$|\.jpg$|\.gif$'
> >>
> >>
> >> On Fri, Sep 2, 2011 at 9:22 AM, Mit Rowe <mit at stagename.com> wrote:
> >>>
> >>> Hello!
> >>> I am using varnish 3.0.1 and have a question about varnishncsalog
> >>> I would like to spit out extra parameters in my logs, so i'm attempting
> >>> to use the -F command line flag.
> >>> However, my need for spaces seems to be causing some problems.
> >>> for example...
> >>> -F %h %t
> >>> (which i don't expect to work)
> >>> prints
> >>> 127.0.0.1<NEWLINE>
> >>> (and that's it)
> >>> -F '%h %t'
> >>> prints
> >>> '127.0.0.1<NEWLINE>
> >>> -F "%h %t"
> >>> prints
> >>> "127.0.0.1<NEWLINE>
> >>>
> >>> and
> >>> -F %h\ %t
> >>> prints
> >>> 127.0.0.1\<NEWLINE>
> >>> Has anyone had any success specifying a log format containing spaces?
> >>>
> >>>
> >>>
> >>> --
> >>> Will 'Mit' Rowe
> >>> Stagename
> >>> 1-866-326-3098
> >>> mit at stagename.com
> >>> www.stagename.com
> >>> Twitter: @stagename
> >>>
> >>> The information transmitted is intended only for the person or entity
> to
> >>> which it is addressed and may contain confidential and/or privileged
> >>> material. Any review, retransmission, dissemination or other use of
> this
> >>> information by persons or entities other than the intended recipient is
> >>> prohibited. If you received this transmission in error, please contact
> the
> >>> sender and delete all material contained herein from your computer.
> >>>
> >>> _______________________________________________
> >>> varnish-misc mailing list
> >>> varnish-misc at varnish-cache.org
> >>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> >>
> >
> >
> >
> > --
> > Will 'Mit' Rowe
> > Stagename
> > 1-866-326-3098
> > mit at stagename.com
> > www.stagename.com
> > Twitter: @stagename
> >
> > The information transmitted is intended only for the person or entity to
> > which it is addressed and may contain confidential and/or privileged
> > material. Any review, retransmission, dissemination or other use of this
> > information by persons or entities other than the intended recipient is
> > prohibited. If you received this transmission in error, please contact
> the
> > sender and delete all material contained herein from your computer.
> >
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> >
>
>
--
Will 'Mit' Rowe
Stagename*
*1-866-326-3098
mit at stagename.com <josh at stagename.com>
www.stagename.com
Twitter: @stagename
*The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of this
information by persons or entities other than the intended recipient is
prohibited. If you received this transmission in error, please contact the
sender and delete all material contained herein from your computer.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111004/ee659195/attachment-0003.html>
More information about the varnish-misc
mailing list