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

# Fastly HTTPS Endpoint

> This documentation explains how to set up Fastly real-time logs delivery to Profound Agent Analytics platform using Fastly custom HTTPS Endpoint

## Overview

The integration uses Fastly's custom HTTPS endpoint to forward Fastly real-time logs to our Agent Analytics API. Fastly's real-time log streaming offers instant visibility into traffic, performance, threats, and troubleshooting, and streams logs to various destinations including HTTP endpoints. For more information about Fastly real-time logs, [visit the Fastly documentation](https://docs.fastly.com/en/guides/streaming-logs).

## Prerequisites

* A Fastly account

* Access/permission to edit Logging Endpoints

* A Profound Log Ingestion Token for Agent Analytics

## Configuration

<img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/fastly_setup.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=376e9c92e922aed26a434d2028bc0af0" alt="Fastly Detected" width="3680" height="2390" data-path="images/agent-analytics/fastly/fastly_setup.png" />

<Steps>
  <Step title="Step 1">
    Sign into the Fastly console, select your service, and navigate to the Service configuration tab.

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/service_configuration.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=9f5c9b84ec0be5034c9e3d29a998bc68" alt="Service Configuration Tab" width="2542" height="348" data-path="images/agent-analytics/fastly/service_configuration.png" />
  </Step>

  <Step title="Step 2">
    Select "Edit configuration" and navigate to the Logging section.

    Find "HTTPS" and click `+ Create endpoint`

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/logging_endpoint.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=1fdf94eb3baeea16c21a0b2d651602f7" alt="Logging Endpoint" width="2490" height="2018" data-path="images/agent-analytics/fastly/logging_endpoint.png" />
  </Step>

  <Step title="Step 3">
    Configure your HTTPS endpoint with the following settings:

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/create_https_endpoint.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=f229d92714f0e359e77fe14b9e625acf" alt="Configuration" width="1348" height="1840" data-path="images/agent-analytics/fastly/create_https_endpoint.png" />

    * **Name:** Add an informative name

    * **Placement:** Use the default

    * **URL:** Enter `https://artemis.api.tryprofound.com/v1/logs/fastly`

    * **Maximum logs & Maximum bytes:** Optional, configure as needed.

    * **Log format**: Paste the following log format. This governs what information will be sent to the Agent Analytics API. If you use a different format, your logs may be rejected by the API.

      ```
        {
            "timestamp": "%{strftime(\{"%Y-%m-%dT%H:%M:%S%z"\}, time.start)}V",
            "client_ip": "%{req.http.Fastly-Client-IP}V",
            "start_time": "%{begin:%Y-%m-%dT%H:%M:%S%z}t",
            "end_time": "%{end:%Y-%m-%dT%H:%M:%S%z}t",
            "host": "%{req.http.Host}V",
            "url": "%{json.escape(req.url)}V",
            "request_method": "%{json.escape(req.method)}V",
            "request_referer": "%{json.escape(req.http.referer)}V",
            "request_user_agent": "%{json.escape(req.http.User-Agent)}V",
            "response_status": %{resp.status}V,
            "response_body_size": %{resp.body_bytes_written}V
        }
      ```

      * Time and IP

        * `timestamp` - Time when the request was completed

        * `client_ip` - Client IP address

      * Request Details

        * `request_method` - HTTP request method

        * `host` - Requested host header

        * `url` - Request url path

        * `request_referer` - Request referrer

        * `request_user_agent` - Client user agent

      * Response Details

        * `start_time` - The time at which the request began

        * `end_time` - The time at which the request finished

        * `response_status` - HTTP response status

        * `response_body_size` - Response size in bytes

      *For more information see the [documentation](https://docs.fastly.com/en/guides/useful-variables-to-log)*

          <Note>
            You may see a warning like:

            <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/warning_message.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=05aab745a4e1946bb2ae3cec2df9527c" alt="Warning Message" width="1908" height="130" data-path="images/agent-analytics/fastly/warning_message.png" />

            You can safely ignore this message. The validation has been configured for you.
          </Note>
  </Step>

  <Step title="Step 4">
    Next, click "Attach a condition"

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/attach_a_condition1.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=70409e193f42a771baa45bb24c161099" alt="Attach a condition 1" width="934" height="104" data-path="images/agent-analytics/fastly/attach_a_condition1.png" />

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/attach_a_condition2.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=a9c05f001e10b3e81e3b9d7e63bd3817" alt="Attach a condition 2" width="1842" height="264" data-path="images/agent-analytics/fastly/attach_a_condition2.png" />

    Enter the following using your domain name:

    `req.http.host == "my-website.com"`

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/filter_to_host.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=70fb508bcb2ebfc02de72b1603b7ee9b" alt="Filter to host" width="990" height="1100" data-path="images/agent-analytics/fastly/filter_to_host.png" />

    This filter will ensure that only logs for your selected domain are sent to Profound. Select `Save and apply`.
  </Step>

  <Step title="Step 5">
    Scroll down to "Advanced options"

    <img src="https://mintcdn.com/profound-37face47/tg0qbLRw_vFMInTl/images/agent-analytics/fastly/advanced_options.png?fit=max&auto=format&n=tg0qbLRw_vFMInTl&q=85&s=f604cc2170c571c08d0f610874d8c6c2" alt="Advanced Options" width="1942" height="1498" data-path="images/agent-analytics/fastly/advanced_options.png" />

    Configure:

    * **Content type** - `application/json`

    * **Custom header name** - `X-API-Key`

    * **Custom header value** - Your provisioned Log Ingestion Token for Profound's Agent Analytics Platform (`bot_PROFOUND_LOG_INGESTION_TOKEN`)

    * **Method** - `POST`

    * **JSON log entry format** - `Array of JSON`

    * **Select a log line format** - `Blank`
  </Step>

  <Step title="Finished">
    Save your configuration and activate the new service version.
  </Step>
</Steps>

<Check>That's it! Fastly will now send real-time logs to Profound. Data should begin appearing in your dashboard within a few minutes.</Check>

## Troubleshooting

* If logs aren't appearing, verify your HTTPS endpoint configuration

* Check fastly for delivery errors

* Verify your Log Ingestion Token is correct

* Verify your API endpoint is correct

## Additional Resources

* [Fastly's real-time log streaming](https://docs.fastly.com/en/guides/about-fastlys-realtime-log-streaming-features)

* [Log streaming: HTTPS](https://docs.fastly.com/en/guides/log-streaming-https)

* [Log Formats](https://docs.fastly.com/en/guides/useful-log-formats)

* Contact [support@tryprofound.com](mailto:support@tryprofound.com) for API-related questions
