Fastly
Fastly can stream a record of every request that it answers to an HTTPS endpoint. Log Hero adds that endpoint to your Fastly service for you. This includes the requests that Fastly serves from cache, which never get to your origin server. You do not install code on your site. You create one API token in Fastly, and Log Hero does the configuration.
Time: about 10 minutes · Access needed: Fastly account with access to the service, Log Hero account
Before you start
Section titled “Before you start”Make sure that you have:
- A Fastly VCL service. Fastly Compute services are not supported yet. Log Hero shows them in the list, but you cannot select them.
- An active version of that service. If the service was never activated, activate a version in Fastly first.
- A Fastly account that can create a personal API token with the Engineer role.
- The domain added in Log Hero. If it is not, do the Quickstart first.
The connector works with Fastly VCL services on all Fastly plans.
1. Create a Fastly API token
Section titled “1. Create a Fastly API token”Log Hero uses this token once, to add the endpoint to your service. Log Hero does not store the token. You can delete the token after step 2.
-
Create a personal token with these settings:
Setting Value Role Engineer Scope Global Service access The service that you connect Expiration The shortest that Fastly permits -
Copy the token. Fastly shows it only once.
Global scope is required. Fastly has no narrower scope that can write the configuration of a service. Use a personal token, not an automation token. Automation tokens need a superuser in sudo mode. When SSO or MFA is enforced, Fastly does not create them.
2. Connect the service in Log Hero
Section titled “2. Connect the service in Log Hero”- In your Keyword Hero account, open Log Hero → Bot Activity for the domain.
- Choose Log Hero token. The setup page opens.
- Under How to start?, choose Fastly.
- Paste the token into the Fastly API token field.
- Choose Connect.
- If the token gives access to more than one service, select the service from the list.
- Choose Confirm.
Log Hero shows Connected — your data will start showing up in Log Hero within about an hour. You can now delete the Fastly token you created for this setup. Delete the token in Fastly at this point.
What Log Hero changes on your service
Section titled “What Log Hero changes on your service”Log Hero activates a new version of your service. The new version is a copy
of the active version with one addition: an HTTPS logging endpoint named
loghero. The endpoint sends each batch of records to
https://in.app.log-hero.com/fastly-logs with your Log Hero API key in the
X-LogHero-Key header. Log Hero validates the new version in Fastly before it
activates it. If the validation fails, nothing on your service changes.
Fastly checks that the endpoint host permits log delivery before it sends data. Log Hero answers that check for you.
3. Make sure that hits arrive
Section titled “3. Make sure that hits arrive”- In the Fastly console, open the active version of the service and go to
Logging. Make sure that an endpoint named
logherois listed. - Wait up to one hour. Fastly sends a batch about every 30 seconds, and Log Hero needs time to process the first batches.
- Open Log Hero → Bot Activity. Make sure that the status line reads Log Hero is receiving bot traffic for this domain.
- Make sure that Bot hits is not zero.
You do not need to make traffic yourself. Bots arrive on their own, and on most sites the first bot request lands within the hour.
If the setup page shows an error
Section titled “If the setup page shows an error”| Message | Cause | What to do |
|---|---|---|
| We couldn’t validate this token. | The token is wrong or expired, or Fastly did not answer. | Paste the token again. If the error stays, create a new token. |
| This token can’t modify the service configuration. | The token lacks the Engineer role or Global scope. | Create a new token with the settings from step 1. |
| We couldn’t find a VCL service on this account. | The account has only Compute services. | Compute services are not supported yet. Use an origin integration instead. |
| This service has no active version yet. | The service was never activated. | Activate a version in Fastly. Then choose Confirm again. |
| This service is already sending logs to Log Hero. | A loghero endpoint exists on the active version. |
Do nothing. The service is connected. |
| Fastly couldn’t validate the updated configuration, so nothing was changed on your service. | Fastly rejected the new version. | Try again. If the error stays, send an email to integrations@keyword-hero.com. |
| Something went wrong connecting to Fastly. | A temporary error. | Try again. |
If hits stop after a later change to the service
Section titled “If hits stop after a later change to the service”- In the Fastly console, open the active version and go to Logging.
- If the
logheroendpoint is missing, do step 2 of this page again.
If Fastly has delivery errors, they appear in the Error Stream of your Fastly service. Log Hero has no separate delivery status view.
What the connector sends
Section titled “What the connector sends”The loghero endpoint sends one JSON record per request with ten fields.
Log Hero writes the format. You cannot change the fields in Log Hero, and Log
Hero ignores fields that you add in Fastly.
timestampclient_ipmethodhosturlschemestatusttfb_msuarefererFour facts about these fields matter for your reports:
client_ipis required. When the record arrives, Log Hero hashes the address and does not store the raw address. The hash identifies the visitor. A record withoutclient_ipis dropped.- The hostname is the
Hostheader that the visitor sent. Hits land on the domain that the visitor requested, so the service does not need to match a domain in Log Hero. - Timing is measured by Fastly.
ttfb_msis the time Fastly needed to start the response, not the time the visitor waited. The origin integrations measure the time inside your server, so the two values are not comparable. - Every request is logged. Log Hero does not turn on sampling, and the bot counts depend on that. Do not add a sampling condition to the endpoint in Fastly.
What Fastly does not send
Section titled “What Fastly does not send”- Requests that Fastly never sees. Traffic that goes to your origin directly is invisible here. If your DNS has a bare origin hostname, bots will find it.
- Requests that Fastly stops before it logs them. Fastly Next-Gen WAF and rate limiting stop some requests before the logging endpoint sees them. If your Bot Activity report shows far fewer AI crawlers than you expect, examine those rules first.
Disconnect the service
Section titled “Disconnect the service”Log Hero cannot remove the endpoint for you.
- In the Fastly console, clone the active version of the service.
- Go to Logging and delete the endpoint named
loghero. - Activate the new version.
Data stops within the hour. If you connect the service again later, Log Hero creates the endpoint again.
If it does not work
Section titled “If it does not work”Work through No data arriving. Two causes
are specific to Fastly. The first is a loghero endpoint missing from the
active version, described in
If hits stop after a later change to the service.
The second is a delivery error in the Error Stream of the service.
