The way varnish works is it doesn't log to a file or stdout but rather to shared memory, and you can use the varnishlog utility to read it through stdout. Varnish also provides the varnishncsa utility which reads this output and rewrites it in the familiar apache/ncsa access log style. Unfortunately when you emerge varnish it doesn't set up any logging, so here's what I did to get it working: * created the directory /var/log/varnish * added the following line to /etc/conf.d/varnishd: LOGFILE="/var/log/varnish/access.log" * added the following lines to /etc/init.d/varnishd: +++ /etc/init.d/varnishd 2009-05-20 12:17:44.000000000 -0400 @@ -12,11 +12,13 @@ #allow varnishd to lock logfile to memory ulimit -l 82000 start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null + start-stop-daemon --quiet --start --pidfile /var/run/varnishncsa.pid --exec /usr/bin/varnishncsa -- -D -P /var/run/varnishncsa.pid -a -w ${LOGFILE} eend $? } stop() { ebegin "Stopping varnish" start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid + start-stop-daemon --quiet --stop --pidfile /var/run/varnishncsa.pid eend $? } * created the file /etc/logrotate.d/varnish with the following content: /var/log/varnish/*.log { weekly rotate 10 copytruncate delaycompress compress notifempty missingok } So varnishncsa will automatically start/stop along with varnishd via the varnishd initscript, and the last 10 logfiles can be found in /var/log/varnish. Just wanted to share in case this would be useful for other people. I believe the Debian varnish package sets up logging automatically, but I'm not sure. If so, it could also be useful for comparison.
works like a charm. this should be added to the default ebuild. an important parameter is "-c" which only logs client communication. this is what most people probably want in order to work with e.g. awstats. thanks.
this is implemented in 2.0.4-r1. thanks for the suggestion and implementation. kind regards Thilo