Avoiding "(null)" in log output for unset VCL variable

Comments

2 comments

  • joeshaw

    I just came across the if() Fastly VCL extension. Could that be used here?

    https://docs.fastly.com/guides/vcl/miscellaneous-VCL-extensions#if

    0
    Comment actions Permalink
  • Caslyn Cole

    Hi Joe,

    Yep! This would be a great scenario to use the if() extension.

    You can add that directly into your logging format string, so it would look something like this: %h %l %u %t %r %>s if(resp.http.X-Foo, resp.http.X-Foo, "")

    Hopefully that helps!

    0
    Comment actions Permalink

Please sign in to leave a comment.