Getting Fastly service ID in VCL
Is there a way to programatically get the Fastly service ID in VCL, so VCL code can be reused between services?
I have currently created a header in the Fastly UI that contains the service ID, but this seems like a bit of a hack
-
The variable
req.service_id
will return the Fastly service_id. For instance, if you are using a custom logging format in your vcl, you can set the call to your format:log {"syslog "}req.service_id{" my_logging_endpoint_name :: "}
You can then use the same vcl within different services.
Please sign in to leave a comment.
Comments
2 comments