5

Is there a way to extract a vcl configuration file from a running instance of varnish?

That is, I'm debugging varnish on a system I haven't been involved with up until now. There's a lot of confusion from the system owners as to which varnish configuration files have been used to restart and refresh the server. It would be extremely helpful for me to be able to see what VCL configuration file the currently running varnish instance is using. Not the file path (as people are editing these files at will), but the actual contents of the file at the time of varnish's last restart/refresh.

Alana Storm
  • 458
  • 5
  • 16

2 Answers2

7

In your case, I think your best shot would be the command varnishadm vcl.show boot (replace boot by active configuration's name, see varnishadm vcl.list output).

julp
  • 251
  • 1
  • 4
  • Thanks! That (seems to be?) exactly what I was looking for. When you said "best shot" did you have any specific caveats in mind? Or was that just colorful turn of the phrase? – Alana Storm Aug 22 '15 at 04:16
  • I had in mind `include`'d configurations: if I remember correctly, they're now expanded but you may not want to (and vice-versa in older releases). – julp Aug 22 '15 at 09:23
1

Also one can run the following command:

varnishd -C -f /etc/varnish/default.vcl

which will dump the VCL code compiled to C language, then search for static const char *srcbody[3] = { and you will have the effective conf contents

Thomasleveil
  • 441
  • 5
  • 14