varnishncsa -F question

Olivier viapanda at gmail.com
Tue Oct 4 18:44:12 CEST 2011


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111004/1dceddfc/attachment-0003.html>


More information about the varnish-misc mailing list