Varnish Logging

Saint-Genest Gwenael gwenael.saint-genest at
Fri Dec 7 10:43:41 CET 2007

Rich Christiansen wrote:
> Hello, all!

Hi !

> 1) varnishncsa seems to only log the size (in bytes) of the file being
> transfered.  We deal a lot with large files (30MB-100MB), so many of our
> file transfers are cut short.  We need to be able to log exactly how
> many bytes were actually transfered.  Is this possible?

    I think you can't get this information for the moment.

In your case, file transfer is made by RES_WriteObj() (cache_response.c)
with a call to WRK_Sendfile() (cache_pool.c). If you look into thins
function :

                if (WRK_Flush(w) == 0 &&
                    sendfile(*w->wfd, fd, &off, len) != len)

The number of bytes copied (returned by sendfile) is not saved :(

With a little patch you can save this value and use it for statistics.


Saint-Genest Gwenael <gwenael.saint-genest at>
Makina Corpus -
44 boulevard des Pas enchantés FR-44230 Saint-Sébastien-sur-Loire
T : +33 (0) 2 51 79 80 80  P: +33 (0)6 81 05 03 00

More information about the varnish-misc mailing list