Logging Purge Requests


I would like to see a log of all uri purge requests in the remote log stream.

If for example the remote log is called “david”, the following does not seem to work in the vcl snippet as shown https://docs.fastly.com/guides/purging/logging-purge-requests

if (req.method == “FASTLYPURGE”) { log {"syslog “} req.service_id {” <david> :: "} <log string> }

I get the error

Syntax error: Expected ;, got &lt;

Can anyone help me out ?



Hi Owen,

Yes, you can log the purge URL requests from the vcl_recv subroutine.
I believe there is a syntax error inside your <log string>. More than happy to double check what you’ve set in the <log string> if you could send it to support@fastly.com.

Meanwhile, I’ll share a sample of the log format for the <log string> through the VCL snippet. Hope this will help.

if (req.method == "FASTLYPURGE") {
  log {"syslog "} req.service_id {" <LOG NAME> :: "} "[" strftime({"%d/%b/%Y:%H:%M:%S %z"}, time.start) "] " req.request " - URL: " json.escape(req.url) ", Client IP: " req.http.Fastly-Client-IP;