varnishncsa not logging custom headers

I just ran into this issue and this was the top result when searching for it, so I'll post my solution/workaround here for future reference :)

varnishncsa can log values set by std.log("key:value") in VCL 1. I used this to log my custom header. Using your example, add this in your vcl_recv:

set req.http.X-my-header = "blahblah";
std.log("X-my-header:" + req.http.X-my-header);

Then use the following somewhere in your logformat string for varnishncsa (mind the x in stead of the i after the header name):

%{VCL_Log:X-my-header}x