Logging purge requests

If you've set up remote log streaming, you can log URL purge requests by adding the following VCL to the vcl_recv subroutine. For example:

1
2
3
4
5
6
if (req.method == "FASTLYPURGE") {
  log {"syslog "} req.service_id {" my-log-endpoint :: "} 
     {"event=purge; "}
     {"service="} req.service_id {"; "}
  ;
}

The my-log-endpoint must match the name of your logging endpoint in the Fastly web interface.

You can add the VCL via custom VCL or VCL Snippets.

Back to Top