Skip to content

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

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.

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.

  1. Open manage.fastly.com/account/personal/tokens.

  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
  3. 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.

  1. In your Keyword Hero account, open Log Hero → Bot Activity for the domain.
  2. Choose Log Hero token. The setup page opens.
  3. Under How to start?, choose Fastly.
  4. Paste the token into the Fastly API token field.
  5. Choose Connect.
  6. If the token gives access to more than one service, select the service from the list.
  7. 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.

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.

  1. In the Fastly console, open the active version of the service and go to Logging. Make sure that an endpoint named loghero is listed.
  2. Wait up to one hour. Fastly sends a batch about every 30 seconds, and Log Hero needs time to process the first batches.
  3. Open Log Hero → Bot Activity. Make sure that the status line reads Log Hero is receiving bot traffic for this domain.
  4. 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.

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”
  1. In the Fastly console, open the active version and go to Logging.
  2. If the loghero endpoint 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.

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.

timestamp
client_ip
method
host
url
scheme
status
ttfb_ms
ua
referer

Four facts about these fields matter for your reports:

  • client_ip is required. When the record arrives, Log Hero hashes the address and does not store the raw address. The hash identifies the visitor. A record without client_ip is dropped.
  • The hostname is the Host header 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_ms is 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.
  • 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.

Log Hero cannot remove the endpoint for you.

  1. In the Fastly console, clone the active version of the service.
  2. Go to Logging and delete the endpoint named loghero.
  3. Activate the new version.

Data stops within the hour. If you connect the service again later, Log Hero creates the endpoint again.

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.