> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siteline.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fastly

> Forward Fastly HTTPS logs to Siteline

Use Fastly HTTPS logging to stream CDN request logs directly to Siteline Agent Analytics. This setup is manual: you create the Fastly logging endpoint in your Fastly account and use your Siteline website secret key to identify the incoming traffic.

No AWS, S3, EventBridge, Lambda, IAM setup, zip files, CLI scripts, or Fastly API token in Siteline is required.

## Prerequisites

* A Siteline website in **Settings** > **Connected Websites**
* The website secret key for that Siteline website
* Admin or engineer access to the Fastly service that serves your website
* Permission to clone, edit, validate, and activate a Fastly service version

<Info>
  Treat the website secret key like a password. Anyone with this key can submit analytics events for that website.
</Info>

## Setup

<Steps>
  <Step title="Copy your website secret key">
    In Siteline, go to **Settings** > **Connected Websites**, find the website you want to connect, and copy its **Website Secret Key**.
  </Step>

  <Step title="Open your Fastly service">
    In the Fastly dashboard, open the service that serves the same website.
  </Step>

  <Step title="Clone the active version">
    Open **Service configuration**, select the active version, and clone it so you can edit a draft version.
  </Step>

  <Step title="Add an HTTPS logging endpoint">
    In the draft service version, open **Logging** and add an **HTTPS** logging endpoint.
  </Step>

  <Step title="Enter the Siteline endpoint settings">
    Use the settings in the table below. Replace `YOUR_SITELINE_WEBSITE_KEY` with the website secret key you copied from Siteline.
  </Step>

  <Step title="Validate and activate">
    Validate the draft Fastly version. When you are ready for the production service to send logs to Siteline, activate the version.
  </Step>
</Steps>

## Fastly HTTPS logging settings

| Setting               | Value                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name                  | `siteline-traffic`                                                                                                                                                                                                                                                                                                                                                                                                |
| URL                   | `https://api.siteline.ai/v1/intake/fastly`                                                                                                                                                                                                                                                                                                                                                                        |
| Method                | `POST`                                                                                                                                                                                                                                                                                                                                                                                                            |
| Content type          | `application/json`                                                                                                                                                                                                                                                                                                                                                                                                |
| Header name           | `Authorization`                                                                                                                                                                                                                                                                                                                                                                                                   |
| Header value          | `Bearer YOUR_SITELINE_WEBSITE_KEY`                                                                                                                                                                                                                                                                                                                                                                                |
| Period                | `5`                                                                                                                                                                                                                                                                                                                                                                                                               |
| Request max bytes     | `1900000`                                                                                                                                                                                                                                                                                                                                                                                                         |
| Log processing region | `none`                                                                                                                                                                                                                                                                                                                                                                                                            |
| Log format            | `{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%SZ}t","host":"%{json.escape(req.http.host)}V","url":"%{json.escape(req.url)}V","request_method":"%m","response_status":%s,"time_elapsed_usec":%{time.elapsed.usec}V,"request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_referer":"%{json.escape(req.http.Referer)}V","client_ip":"%h","service_id":"%{req.service_id}V","version":"%{req.vcl.version}V"}` |

The Fastly HTTPS logging API documents these fields, including `header_name`, `header_value`, `request_max_bytes`, and `period`: [Fastly HTTPS logging reference](https://www.fastly.com/documentation/reference/api/logging/https/).

## How it works

Fastly sends batches of JSON request records to Siteline:

```text theme={null}
Fastly HTTPS logging
  -> https://api.siteline.ai/v1/intake/fastly
  -> Siteline analytics pipeline
```

When you validate the Fastly HTTPS logging endpoint, Siteline automatically answers Fastly's domain-control challenge for the shared `api.siteline.ai` endpoint.

Siteline reads the `Authorization: Bearer <website secret key>` header, parses each row, skips malformed rows, and maps valid records to Agent Analytics pageviews for the matching website.

## Verify the setup

After you activate the Fastly version, visit your website and wait a short time for Fastly to deliver its next batch. Then refresh Siteline Agent Analytics.

You should see the website integration type become **Fastly** after Siteline receives valid events.

## Disconnect

To stop sending Fastly logs to Siteline, remove or disable the `siteline-traffic` HTTPS logging endpoint in Fastly and activate the updated service version.

If the website secret key may have been exposed, regenerate it in **Settings** > **Connected Websites**. After regenerating the key, update the Fastly HTTPS logging header value to use the new key.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Fastly validation fails">
    Confirm the URL is `https://api.siteline.ai/v1/intake/fastly`, the method is `POST`, and the content type is `application/json`. Fastly HTTPS logging destinations must use HTTPS.
  </Accordion>

  <Accordion title="No traffic appears in Siteline">
    Confirm the `Authorization` header value is `Bearer YOUR_SITELINE_WEBSITE_KEY`, not your Fastly API token. Visit the website after activation and allow time for Fastly's next log batch.
  </Accordion>

  <Accordion title="Events are attached to the wrong website">
    Check that the Fastly header uses the website secret key for the Siteline website you intended to connect.
  </Accordion>

  <Accordion title="You regenerated the website secret key">
    Update the Fastly HTTPS logging endpoint header value to use `Bearer <new website secret key>`, then validate and activate the Fastly version.
  </Accordion>
</AccordionGroup>

<Tip>
  **Need help?** [Book a setup call](https://cal.com/team/siteline/tech-set-up) and we'll walk you through it.
</Tip>
