Fastly Integration
Stream Fastly access logs to Airefs with an HTTPS log streaming endpoint. Works on all Fastly plans, no code changes to your service logic.
Fastly’s real-time log streaming sends every request to Airefs, where bot traffic is classified and assets and error responses are dropped server-side. This powers AI Impressions; to also track Clicks, add the client-side tracking script from Site Settings → Tracking Script.
Your access token is in your Airefs account under Site Settings → Access Token.
Setup
- In the Fastly control panel, open your service, click Edit configuration, and go to Logging.
- Create a new HTTPS endpoint with these settings:
| Setting | Value |
|---|---|
| URL | https://api.getairefs.com/v1/logs/fastly |
| Method | POST |
| Content type | application/json |
| Custom header name | X-API-Key |
| Custom header value | your Airefs access token |
| JSON log entry format | Array of JSON |
| Log line format | Blank |
| Format version | 2 |
| Maximum bytes per request | 5000000 (5 MB) |
- Set the log format to exactly this template:
{"event_id":"%{req.xid}V","timestamp":"%{begin:%Y-%m-%dT%H:%M:%S%z}t","client_ip":"%{req.http.Fastly-Client-IP}V","hostname":"%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V","request_path":"%{json.escape(req.url.path)}V","query_string":"%{json.escape(req.url.qs)}V","request_method":"%{json.escape(req.method)}V","status_code":%{resp.status}V,"content_type":"%{json.escape(resp.http.Content-Type)}V","user_agent":"%{json.escape(req.http.User-Agent)}V","referrer":"%{json.escape(req.http.Referer)}V","country_code":"%{client.geo.country_code}V"}- Attach this response condition so shielded requests are logged only at the edge POP:
fastly.ff.visits_this_service == 0If the service fronts multiple domains, combine the shielding guard with your tracked hostname:
fastly.ff.visits_this_service == 0 && req.http.host == "yourdomain.com"- Activate the new service version.
Fastly validates log destination domains automatically against Airefs’s /.well-known/fastly/logging/challenge endpoint — there is nothing to configure for it.
Verification
Visit a few pages served by Fastly. Events appear in your Airefs dashboard within a few minutes.
Outside dry-run mode, a successful response means Airefs stored every accepted record and reports why the rest were dropped. For a one-off test before going live, POST a sample record with ?dry_run=1 appended to the endpoint URL: Airefs returns a per-record verdict, including the bot classification it detected, without storing anything.
No events? Confirm the X-API-Key header value is your exact access token (a wrong token returns 401, which Fastly does not surface prominently) and the log format matches the template exactly. Need help? Email support@getairefs.com.
