1

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

2

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

sudo varnishlog -N <file.vsm> -d
  • Whether I do it via sudo or as being root the result is: Can't open log - retrying for 5 seconds. Maybe it's not in the expected format. – cherouvim Aug 18 '17 at 11:42
  • What happen if you try to read the varnishlog file currently being written? I mean something like: sudo varnishlog -N /var/lib/varnish/hostname/_.vsm -d – francisv Aug 18 '17 at 13:58
  • Yes, that works, but that file doesn't seem to relate to those large daily archived varnishlog generated files I have in /var/log/varnish. – cherouvim Aug 19 '17 at 4:48
0

The correct way was indeed using -r but my files were corrupted due to an improper way of rotating them in a customized /etc/logrotate.d/varnish. Reverting to the default rotate method worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.