Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Platform overview

What is Axiom?QuickstartArchitectureFeatures
Fundamentals
Datasets
Edge deployments
Limits
Performance
Optimize usage
Requirements
Semantic conventions
Glossary
Tour
SecurityRoadmap

Send data

Reference architecturesMethods

Understand data

Console
Query
Builder
Editor
Query results
Visualize
Traces
Metrics
Correlations
Save queries
Stream
Dashboard
Create
Elements
Create
Configure
Element types
Gauge
Heatmap
Log stream
Monitor list
Note
Pie chart
Scatter plot
Statistic
Table
Time series
Sections
Configure
Filter
Monitor
Overview
View status
Configure
Examples
Monitor types
Anomaly
Match
New values
Threshold
Alerting
Overview
Configure
Notifier types
Amp
ChatGPT Workspace Agent
Claude Code
Cursor
Custom Webhook
Discord
Email
incident.io
Jira Service Management
Microsoft Teams
Opsgenie
PagerDuty
Slack
Annotations
Command Menu
Manage
Datasets
Overview
Views
Virtual fields
Access
RBAC
Tokens
CLI
Organization
Labels
Audit log
Settings
Usage and billing
Profile
Extend
Overview
AWS Lambda
AWS PrivateLink
Cloudflare Workers
Cloudflare Logpush
Convex
Grafana
Hex
Netlify
Supabase
Supabase metrics
Tailscale
Terraform
Unkey
Vercel
Intelligence
Overview
Spotlight
AI agents
Overview
MCP Server
Overview
Tools
Query cost limits
Agent-created orgs
Skills
Overview
Axiom alerting
Build dashboards
Control costs
SRE
Translate SPL to APL
Splunk
Overview
Splunk app
Install and configure
Commands
Traces
Examples
Portal
How it works
Set up standard mode
Set up transparent mode
Observability Cloud
OCSF data
OCSF as CIM
SPL command support
Examples
Monitor and troubleshoot

Use cases

ObservabilityProduct analytics
OCSF security data
Overview
Send data
Query data
LLM observability
Overview
Use Vercel AI SDK
Manual instrumentation
OpenAI Agents SDK
GenAI attributes
Redaction policies

Miscellaneous

LLMs
Overview
List of docs pages
Full docs
Query reference
FAQs
Legal
Acceptable use policy
Axiom for Startups terms
Committed use terms
Cookies
Data processing
HIPAA
Partner agreement
Partner program guide
Privacy policy
SLA
Terms of service
Terms of use

Send data from Fastly to Axiom

This page explains how to stream Fastly real-time logs to Axiom through the Splunk HEC-compatible API.

Fastly is an edge cloud platform that delivers and caches content for your websites and APIs. Fastly real-time log streaming sends a log line for every request that a Fastly service handles. Stream these logs to Axiom to analyze cache performance, errors, latency, and traffic across Fastly points of presence (POPs).

To send Fastly logs to Axiom, configure a Fastly Splunk logging endpoint that posts to the Axiom Splunk HEC-compatible API. This works for both CDN (VCL) services and Compute services.

Prerequisites

  • Create an Axiom account.
  • Create a dataset in Axiom where you send your data.
  • Create an API token in Axiom with permissions to ingest data to the dataset you have created.
  • Create a Fastly account with a CDN or Compute service.

Configure the Splunk logging endpoint

In Fastly, create a Splunk logging endpoint for your service. For more information, see the Fastly documentation. Use the following settings:

SettingValue
NameA name for the endpoint, for example axiom. For Compute services, use the endpoint name that your code logs to.
PlacementFormat Version Default
Log formatThe JSON log format in Recommended log format. CDN services only.
URLhttps://hec.AXIOM_DOMAIN/services/collector/event
TokenThe Axiom API token.
Use TLS?Yes. Leave the TLS hostname and certificate fields empty.
Maximum logs0 (no limit)
Maximum bytes4194304. This is the maximum request size that Axiom accepts.
Info

Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.

The Axiom Splunk HEC API is hosted at hec.AXIOM_DOMAIN. For example, if your edge deployment’s base domain is us-east-1.aws.edge.axiom.co, the URL is https://hec.us-east-1.aws.edge.axiom.co/services/collector/event.

After you create the endpoint, activate the new version of your service. Fastly starts to batch log lines and post them to Axiom. It can take a few minutes after activation before the first events appear in your dataset.

The index field of each log line selects the Axiom dataset. If you leave out index, Axiom sends the events to the dataset that the API token is scoped to, provided that the token grants ingest access to exactly one dataset. For more information, see Choose the target dataset.

Recommended log format

Each log line that Fastly sends must be a Splunk HEC event envelope. Axiom turns the keys of the event object into top-level fields, uses time as the event timestamp, and keeps host, source, sourcetype, and index as fields. For more information, see Event envelope fields.

The following log format for CDN services records the request, the response, the cache state, timing, and the location of the client and the POP. It uses VCL variables and runs in vcl_log, which is the default placement for the current format version. Strings that come from the client pass through json.escape so that each line stays valid JSON.

JSON
{
  "time": %{time.start.msec}V,
  "host": "%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
  "source": "fastly",
  "sourcetype": "fastly:cdn",
  "index": "DATASET_NAME",
  "event": {
    "service_id": "%{req.service_id}V",
    "service_version": %{req.vcl.version}V,
    "request_id": "%{req.xid}V",
    "client_ip": "%{req.http.Fastly-Client-IP}V",
    "client_asn": %{client.as.number}V,
    "geo_country_code": "%{client.geo.country_code}V",
    "geo_city": "%{json.escape(client.geo.city.utf8)}V",
    "geo_continent_code": "%{client.geo.continent_code}V",
    "request_method": "%{json.escape(req.method)}V",
    "request_url": "%{json.escape(req.url)}V",
    "request_protocol": "%{json.escape(req.proto)}V",
    "request_referer": "%{json.escape(req.http.Referer)}V",
    "request_user_agent": "%{json.escape(req.http.User-Agent)}V",
    "request_body_bytes": %{req.body_bytes_read}V,
    "tls_protocol": "%{json.escape(tls.client.protocol)}V",
    "is_h2": %{if(fastly_info.is_h2, "true", "false")}V,
    "response_status": %{resp.status}V,
    "response_body_bytes": %{resp.body_bytes_written}V,
    "response_bytes": %{resp.bytes_written}V,
    "response_content_type": "%{json.escape(resp.http.Content-Type)}V",
    "cache_state": "%{json.escape(fastly_info.state)}V",
    "duration_us": %{time.elapsed.usec}V,
    "pop": "%{server.datacenter}V",
    "pop_region": "%{server.region}V",
    "fastly_is_edge": %{if(fastly.ff.visits_this_service == 0, "true", "false")}V
  }
}
Info

Replace DATASET_NAME with the name of the Axiom dataset where you send your data.

The format uses the following conventions:

  • time is the start of the request in milliseconds since the Unix epoch.
  • Numeric and Boolean values aren’t quoted, so you can aggregate them in Axiom without converting their type.
  • cache_state contains the Fastly cache state, for example HIT, MISS, or PASS.
  • fastly_is_edge is true on the POP that received the request from the client. If you use shielding, a request can be logged once on the edge POP and once on the shield POP. Filter on fastly_is_edge == true to count each client request once.

Optional: Remove fields that you don’t need, or add other VCL variables. If client IP addresses are personal data under your privacy policy, remove client_ip or truncate it before it leaves Fastly.

Log from Compute services

Compute services don’t use the Log format setting. Instead, your code writes each log line to the named logging endpoint. Write each line as a JSON object with the same envelope: time, index, and the fields of the request in event. For more information, see the Compute example in the Fastly documentation.

Query Fastly logs

The following query shows the cache hit ratio and the 95th percentile request duration for each POP:

APL
['DATASET_NAME']
| where fastly_is_edge == true
| summarize requests = count(), hit_ratio = round(100.0 * countif(cache_state startswith "HIT") / count(), 2), p95_duration_ms = percentile(duration_us, 95) / 1000.0 by pop
| sort by requests desc

The following query shows the number of server errors over time for each URL:

APL
['DATASET_NAME']
| where response_status >= 500
| summarize count() by bin_auto(_time), request_url

Add queries like these to a dashboard to monitor your Fastly services. For example, the following dashboard shows traffic, cache performance, latency, and errors across POPs:

Dashboard of Fastly CDN logs in Axiom
└Dashboard of Fastly CDN logs in Axiom

Alternative: Generic HTTPS endpoint

Fastly’s HTTPS logging endpoint posts batches of JSON to any HTTPS URL. Before Fastly sends logs to an HTTPS endpoint, it verifies that you control the domain: it requests /.well-known/fastly/logging/challenge on the host in the endpoint URL and expects a list of permitted service IDs in the response. Axiom’s ingest hosts don’t answer this challenge, so you can’t point the HTTPS endpoint directly at the Axiom ingest API. Use the Splunk endpoint instead.

If you already route logs through your own HTTPS gateway that answers the challenge, the gateway can forward the batches to the Axiom ingest API:

  • URL: https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME
  • Headers: Authorization: Bearer API_TOKEN and Content-Type: application/x-ndjson
  • Body: newline-delimited JSON. In Fastly, set JSON log entry format to Newline delimited. Leave out the Splunk envelope. Put the fields of the event object at the top level, and rename time to _time so that Axiom uses it as the event timestamp.
Info

Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.

Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

Replace DATASET_NAME with the name of the Axiom dataset where you send your data.

Send traces from Compute with OpenTelemetry

Optional: To send traces from a JavaScript Compute service, use the @fastly/compute-js-opentelemetry library. Its OTLPTraceExporter sends OTLP/HTTP JSON through a Fastly backend.

  1. In your Fastly service, add a backend for the host AXIOM_DOMAIN on port 443 with TLS enabled, and name it, for example, axiom. For more information, see the Fastly documentation.

  2. Configure the exporter to send traces to the Axiom OTLP endpoint:

    javascript
    import { OTLPTraceExporter } from "@fastly/compute-js-opentelemetry/exporter-trace-otlp-fastly-backend";
    import { FastlySDK } from "@fastly/compute-js-opentelemetry/sdk-fastly";
    
    const traceExporter = new OTLPTraceExporter({
      // Name of the Fastly backend for AXIOM_DOMAIN
      backend: "axiom",
      url: "https://AXIOM_DOMAIN/v1/traces",
      headers: {
        Authorization: "Bearer API_TOKEN",
        "X-Axiom-Dataset": "DATASET_NAME",
      },
    });
    
    const sdk = new FastlySDK({ traceExporter });
    await sdk.start();
    Info

    Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.

    Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

    Replace DATASET_NAME with the name of the Axiom dataset where you send your data.

    Recommended: Read the API token from a Fastly secret store instead of writing it in your code.

For more information about the Axiom OTLP endpoints, see Send OpenTelemetry data to Axiom.

Was this page helpful?
Suggest edits on GitHub
On this page
Configure the Splunk logging endpointRecommended log formatLog from Compute servicesQuery Fastly logsAlternative: Generic HTTPS endpointSend traces from Compute with OpenTelemetry