varnishncsa -F flag custom log format
Christophe Gasmi
rekcah78 at gmail.com
Sun May 27 22:20:21 CEST 2012
Hi,
in the init file (Ubuntu):
I set:
+ LOG_FORMAT="%{Host}i %h %l %u %t \"%r\" %s %b \"%{Referer}i\"
\"%{User-agent}i\""
- DAEMON_OPTS="-a -w ${LOGFILE} -D -P ${PIDFILE}"
+ DAEMON_OPTS="-a -w ${LOGFILE} -D -P ${PIDFILE} -F"
- --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
+ --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} "${LOG_FORMAT}" \
Now I have a correct log line:
www.XXXXXX.com 2a01:e35:2f16:....:21b:..ff:....:1c0f - -
[27/May/2012:22:07:05 +0200] "GET http://www.XXXXXX.com/favicon.ico
HTTP/1.1" 404 188 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8)
AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52
Safari/536.5"
But now I want to change the value %r not contain http://www.XXXXXX.com :)
Christophe
2012/5/27 Rowan @ Jetboy <rowan at jetboy.co.uk>:
> Hi Daniel,
>
> Thanks for the reply. I've tried entirely replacing my code with yours
> (other than the capitalisation of $PIDFILE, and putting $logfile inline),
> but I get similar results. It's only recording the first log parameter in
> the log (in this case, the host IP). The single quotes result in the first
> single quote being recorded in the log. E.g.:
>
> '66.249.72.57
> '157.55.17.194
>
> Are you running Varnish on Linux with bash, or some other OS flavour?
>
>
> <snip>
>
> This one works for me:
>
> LOG_FORMAT="%h %l %u %t \"%r\" %s %b \"%{Referer}i\"
> \"%{User-agent}i\" %{Host}i %{Varnish:time_firstbyte}x"
> DAEMON_OPTS="-c -a -w $logfile -D -P $pidfile -F '${LOG_FORMAT}'"
>
> Please, note the single quotes in -F
>
> Hope this help.
>
> </snip>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list