Custom fields allow you to add any request/response header to your CDN logs using the "sc:" and "cs:" prefixes respectively. As long as the header exists, then there is no limitation as long as these prefixes are used.
This guide will explain how to use and configure custom log streaming fields.
Server to Client Headers
Server (origin) to client (CDN) headers, or sc headers, are custom response headers that are added to your logs. For example, you can configure a custom field such as sc:x-hw, which would, add the x-hw response header to your log stream. x-hw headers are debug headers that are often used to check whether or not a file was served from cache or proxied from the origin.
Please see this guide to learn more about x-hw headers.
Client to Server Headers
Client to server headers, or cs headers, are custom request headers that are added to your logs. For example, you might have a custom request header, x-sp-geo, that returns the location of a request. You can configure a custom field such as cs:x-sp-geo, which would add the this request header to your log stream.
Adding Custom Fields
You can add custom fields to your logs when creating a new Policy.
To create a new Policy:
- In the StackPath Control Portal, in the left-side navigation menu, click Log Streaming.
- Expand the Exporter you'd like to create a Policy for, then click the Add Policy button.
- Select the Data Source(s) and Site you'd like to configure a Policy for. Then click Next.
- Select the fields you'd like to receive data for. If no specific fields are selected, then all of them will be sent by default. Add your desired list of custom fields here as well, making sure to use the ":" character. When you are finished, click Next.
- If the details shown on this screen are correct, click Finish.
When viewing logs, any custom field configured will appear in the JSON object as