How To Add Hit/Miss to Logging
I’ve followed the directions on this page:
https://docs.fastly.com/guides/log-streaming/setting-up-remote-log-streaming
and successfully set up logging with Papertrail. I have several questions:
-
This page mentions “resp.http.X-Cache - add HIT/MISS logging”, but how do I do this using the the type of string they use as an example: %h %l %u %t %r %>s %b ?
-
On my server (the origin), in the IIS logs, what am I seeing, ie, should all traffic now be from Fastly, except for passes?
Thanks!
Steph
-
Hi Steph,
-
You can just use VCL variables in your format string. So for example:
%h %l %u %t %r %>s %b fastly_info.state
-
If you have changed your DNS to point everything at Fastly, yes. You should see all requests to be coming from Fastly netblocks, including passes. Passes are passed through, so there's no caching, but the clients still talk to Fastly servers, and those talk to your origins.
This allows you to tweak the requests and responses with VCL and/or settings in the UI. And it also gives you Dynamic Site Acceleration, which works best if you designate a shield datacenter close to your origin. Because we keep connections open between our datacenters and to your origins, a lot of (TCP and TLS) round trips disappear which cuts down on the time to first byte, despite going back to origin.
You might also want to consider adding the Fastly-Client-IP header to your IIS logs, so you can tell what the client IP was from Fastly's perspective. Alternatively, you can setup X-Forwarded-For and use that.
-
-
Thank you for the quick reply.
As for requests, I have a related question. When I changed the dns entries for my domain -- adding the cname for fastly -- it was not possible (I believe), to cname BOTH www and non-www versions of my domain. My application rewrites urls that come to the site without www to the www version. I'm assuming that if someone requests the url http:mydomain.com, it will go to my server first, and then subsequent requests (which will have www added to them) will go through fastly. Is there any way to make both www and non-www versions of my domain to go through fastly?
Thanks! Steph
-
To avoid confusion, this question was answered in https://community.fastly.com/t/www-and-apex-domains/326 :)
Please sign in to leave a comment.
Comments
3 comments