How can I read old varnish logs

loggingvarnish

In /var/log/varnish/ I have some old varnish logs, produced by varnishlog which, due to logrotated, are now in gz format:

-rw-r--r--  1 varnishlog varnish 143068514 Aug 10 23:59 varnish.log.2017-08-10.gz
-rw-r--r--  1 varnishlog varnish 156373518 Aug 11 23:59 varnish.log.2017-08-11.gz
-rw-r--r--  1 varnishlog varnish 134255825 Aug 12 23:59 varnish.log.2017-08-12.gz
-rw-r--r--  1 varnishlog varnish 156992529 Aug 13 23:59 varnish.log.2017-08-13.gz
-rw-r--r--  1 varnishlog varnish 176751837 Aug 14 23:59 varnish.log.2017-08-14.gz
-rw-r--r--  1 varnishlog varnish 155948012 Aug 16 00:01 varnish.log.2017-08-15.gz
-rw-r--r--  1 varnishlog varnish 169977134 Aug 17 00:01 varnish.log.2017-08-16.gz

I've extracted those in another location and tried to view them via head/more but they look binary.

So I then tried opening them with varnishlog using either of the following parameters:

[-N filename]             VSM filename
[-r filename]             Binary file input

But that didn't work giving me:

Can't open log - retrying for 5 seconds

and:

Can't open log file (Not a VSL file:

Any idea on how can I inspect those historical logs from varnish?

p.s I use varnish-4.1.1

Best Answer

The error you see is due to lack of privilages. Try:

sudo varnishlog -N <file.vsm> -d