Log streaming: Splunk

Fastly's Real-Time Log Streaming feature can send log files to Splunk. Splunk is a web-based log analytics platform used by developers and IT teams.


Fastly does not provide direct support for third-party services. Read Fastly's Terms of Service for more information.


To use Splunk as a logging endpoint, you'll need to enable the HTTP Event Collector (HEC), create a token, and enable it. Follow the instructions on Splunk's website:

  1. Enable HEC.
  2. Create an HEC token.
  3. Enable the HEC token.
  4. Disable indexer acknowledgment for tokens used by Fastly to stream logs.

You'll need to remember the HEC token and find the URL for your collector. The URL structure depends on the type of Splunk instance you're using. Use the table below to find the URL structure for your Splunk instance.

Self hostedhttps://<hostname>:8088/services/collector/event
Self-service Splunk Cloud planshttps://input-<hostname>:8088/services/collector/event
All other Splunk Cloud planshttps://http-inputs-<hostname>:8088/services/collector/event

While logged in to Splunk, you can find the hostname for the URL in your web browser's address bar.

Adding Splunk as a logging endpoint

After you've created a Splunk account and obtained your customer token, follow these instructions to add Splunk as a logging endpoint for Fastly services:

  1. Deliver services
  2. Compute services
  1. Review the information in our guide to setting up remote log streaming.
  2. In the Splunk area, click Create endpoint.
  3. Fill out the Create a Splunk endpoint fields as follows:
    • In the Name field, enter a human-readable name for the endpoint.
    • In the Placement area, select where the logging call should be placed in the generated VCL. Valid values are Format Version Default, waf_debug (waf_debug_log), and None. Read our guide on changing log placement for more information.
    • In the Log format field, enter an Apache-style string or VCL variables to use for log formatting. You can use our recommended log format.
    • In the URL field, enter the URL to send data to (e.g., https://<splunk_host>:8088/services/collector/event/1.0).
    • In the Token field, enter the token for the HEC.
    • (Optional) From the Use TLS controls, select whether or not to enable TLS. When you select Yes, additional TLS fields appear.
    • In the TLS hostname field, optionally enter a hostname to verify the logging destination server's certificate. This should be one of the Subject Alternative Name (SAN) fields for the certificate. Common Names (CN) are not supported. If you are using Splunk Enterprise see the Splunk Enterprise section below for more information.
    • In the TLS CA certificate field, enter the CA certificate used to verify that the origin's certificate is valid. It must be in PEM format. This is not required if your origin-side TLS certificate is signed by a well-known CA. See the using TLS CA certificates section for more information.
    • (Optional) In the TLS client certificate field, copy and paste the TLS client certificate used to authenticate to the origin server. The TLS client certificate you upload must be in PEM format and must be accompanied by a client certificate. A TLS client certificate allows your server to authenticate that Fastly is performing the connection. This field only appears when you select Yes from the Use TLS menu.
    • (Optional) In the TLS client key field, copy and paste the TLS client key used to authenticate to the backend server. The TLS client key you upload must be in PEM format and must be accompanied by a TLS client certificate. A TLS client key allows your server to authenticate that Fastly is performing the connection.
    • (Optional) In the Maximum logs field, enter the maximum number of logs to append to a batch, if non-zero.
    • (Optional) In the Maximum bytes field, enter the maximum size of the log batch, if non-zero.
  4. Click Create to create the new logging endpoint.
  5. Click Activate to deploy your configuration changes.

We recommend using the following log format to send data to Splunk.


All JSON sent to the Splunk HEC must have an event field. The event field can be text or nested JSON. There can also be other meta data in the payload. See the Splunk documentation for more information.

2 "time":%{time.start.sec}V,
3 "host":"%{Fastly-Orig-Host}i",
4 "event": {
5 "service_id":"%{req.service_id}V",
6 "time_start":"%{begin:%Y-%m-%dT%H:%M:%S%Z}t",
7 "time_end":"%{end:%Y-%m-%dT%H:%M:%S%Z}t",
8 "time_elapsed":%D,
9 "client_ip":"%h",
10 "client_as_name":"%{client.as.name}V",
11 "client_as_number":"%{client.as.number}V",
12 "client_connection_speed":"%{client.geo.conn_speed}V",
13 "request":"%m",
14 "protocol":"%H",
15 "origin_host":"%v",
16 "url":"%{cstr_escape(req.url)}V",
17 "is_ipv6":%{if(req.is_ipv6, "true", "false")}V,
18 "is_tls":%{if(req.is_ssl, "true", "false")}V,
19 "tls_client_protocol":"%{cstr_escape(tls.client.protocol)}V",
20 "tls_client_servername":"%{cstr_escape(tls.client.servername)}V",
21 "tls_client_cipher":"%{cstr_escape(tls.client.cipher)}V",
22 "tls_client_cipher_sha":"%{cstr_escape(tls.client.ciphers_sha )}V",
23 "tls_client_tlsexts_sha":"%{cstr_escape(tls.client.tlsexts_sha)}V",
24 "is_h2":%{if(fastly_info.is_h2, "true", "false")}V,
25 "is_h2_push":%{if(fastly_info.h2.is_push, "true", "false")}V,
26 "h2_stream_id":"%{fastly_info.h2.stream_id}V",
27 "request_referer":"%{Referer}i",
28 "request_user_agent":"%{User-Agent}i",
29 "request_accept_content":"%{Accept}i",
30 "request_accept_language":"%{Accept-Language}i",
31 "request_accept_encoding":"%{Accept-Encoding}i",
32 "request_accept_charset":"%{Accept-Charset}i",
33 "request_connection":"%{Connection}i",
34 "request_dnt":"%{DNT}i",
35 "request_forwarded":"%{Forwarded}i",
36 "request_via":"%{Via}i",
37 "request_cache_control":"%{Cache-Control}i",
38 "request_x_requested_with":"%{X-Requested-With}i",
39 "request_x_att_device_id":"%{X-ATT-Device-Id}i",
40 "request_x_forwarded_for":"%{X-Forwarded-For}i",
41 "status":"%s",
42 "content_type":"%{Content-Type}o",
43 "response_state":"%{fastly_info.state}V",
44 "response_age":"%{Age}o",
45 "response_cache_control":"%{Cache-Control}o",
46 "response_expires":"%{Expires}o",
47 "response_last_modified":"%{Last-Modified}o",
48 "response_tsv":"%{TSV}o",
49 "server_datacenter":"%{server.datacenter}V",
50 "server_ip":"%A",
51 "geo_city":"%{client.geo.city.utf8}V",
52 "geo_country_code":"%{client.geo.country_code}V",
53 "geo_continent_code":"%{client.geo.continent_code}V",
54 "geo_region":"%{client.geo.region}V",
55 "req_header_size":%{req.header_bytes_read}V,
56 "req_body_size":%{req.body_bytes_read}V,
57 "resp_header_size":%{resp.header_bytes_written}V,
58 "resp_body_size":%B,
59 "socket_cwnd":%{client.socket.cwnd}V,
60 "socket_nexthop":"%{client.socket.nexthop}V",
61 "socket_tcpi_rcv_mss":%{client.socket.tcpi_rcv_mss}V,
62 "socket_tcpi_snd_mss":%{client.socket.tcpi_snd_mss}V,
63 "socket_tcpi_rtt":%{client.socket.tcpi_rtt}V,
64 "socket_tcpi_rttvar":%{client.socket.tcpi_rttvar}V,
65 "socket_tcpi_rcv_rtt":%{client.socket.tcpi_rcv_rtt}V,
66 "socket_tcpi_rcv_space":%{client.socket.tcpi_rcv_space}V,
67 "socket_tcpi_last_data_sent":%{client.socket.tcpi_last_data_sent}V,
68 "socket_tcpi_total_retrans":%{client.socket.tcpi_total_retrans}V,
69 "socket_tcpi_delta_retrans":%{client.socket.tcpi_delta_retrans}V,
70 "socket_ploss":%{client.socket.ploss}V
71 }

Using TLS CA certificates

If you've installed your own TLS certificate in Splunk Enterprise or Splunk Cloud, you'll need to provide the corresponding CA certificate.

Splunk Cloud

For Splunk Cloud, the default set up has the following CA certificate:


Splunk Enterprise

Splunk Enterprise provides a set of default certificates, but we strongly recommend you configure your own certificates for your Fastly logging endpoint rather than relying on the default certificates. The certificates provided by Splunk Enterprise only specify a Common Name (CN), which cannot be used to properly verify the identity of the Splunk host presenting the certificate. Additionally, these certificates are less secure because the same root certificate is available in every Splunk Enterprise download. We encourage you to maintain the best possible security posture by configuring your own certificates rather than relying on the default certificates. The Splunk documentation provides a guide for configuring your own certificates.

Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.