Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.95 KB

runbook-fastly-debug.md

File metadata and controls

63 lines (49 loc) · 1.95 KB

Runbook: Fastly debugging

Real-time logging

Aggregate statistics are available under the "Edge Observer" tab of the Observability page in Fastly, this includes for example requests by cache response type (hit, miss, pass, synthetic, error), status code, object size, and HTTP version.

There isn't a built-in way to review, e.g. a sampled web request log, but you can debug actual requests by setting up a logging endpoint under one of the "services" in your account. This endpiont then receives a stream of real-time log events.

Documentation:

Example: Log "pass" requests

Log the request URLs of requests that are considered uncachable (as opposed to a cache "miss").

Condition:

req.http.Fastly-Cachetype == "PASS"

Logging endpoint:

  • Condition: "If pass"
  • Placement: "Format Version Default"
  • Log format: (simplified from the default to not contain any obvious PII)
    {
      "host": "%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
      "url": "%{json.escape(req.url)}V",
      "request_method": "%{json.escape(req.method)}V",
      "response_status": %{resp.status}V
    }
  • URL: A newly generated URL from https://log-bin.fastly.dev/
  • Advanced
    • Content type: text/plain
    • Method: POST
    • JSON log entry format: "Newline delimited"
    • Select a log line format: "Blank"

Example: Sampled "miss" log

req.http.Fastly-Cachetype == "PASS"