AWS CloudFront
CloudFront access logs record every request to your site. Each request includes the user-agent, which identifies AI crawlers such as GPTBot, ClaudeBot and PerplexityBot. When you give Sitefire read-only access to these logs, Sitefire shows which AI bots visit which pages, how often, and how this changes over time.
Time needed: about 15 minutes, in two steps: turn on logging, then create an IAM role.
How it works
CloudFront writes gzip-compressed log files to S3. Each line has the URL path, the time and the user-agent. Sitefire uses a read-only IAM role in your AWS account to read new log files. It keeps only the requests from AI bots and shows them in your dashboard.
Datadog, New Relic and other SaaS tools use the same cross-account IAM role. You share no credentials, and you can remove the access at any time.
Step 1: Turn on CloudFront logging
If your distribution already has logging on, go to Step 2.
New setup (v2)
Use Standard Logging v2 (released November 2024) for a new setup. It sends logs to S3 without bucket ACLs, and the console sets all permissions for you.
Open the Logging tab
Go to CloudFront > Distributions. Select your distribution, open the Logging tab and click Add.
Set up S3 delivery
- Select Amazon S3 as the destination.
- Select or create an S3 bucket, for example
yourcompany-cf-logs. - If you want, set a prefix.
- Output format: select W3C. Sitefire can read only this format.
- Field selection: make sure that cs(User-Agent) is included. It is included by default.
The console creates the S3 bucket policy for you. You do not need to set permissions.
Save
The first logs arrive in your bucket after a few minutes.
Make sure that logs arrive
Wait 5 minutes. Then look for files in your bucket:
aws s3 ls s3://YOUR-BUCKET/YOUR-PREFIX/ --recursive --summarize | tail -3The output must show .gz files. If the bucket is empty, make sure that you turned on logging for the correct distribution.
Step 2: Create an IAM role for Sitefire
This role gives Sitefire read-only access to your log bucket, and to nothing else.
The Sitefire app shows your Account ID and External ID. To find them, go to Crawler Analytics → Connect CDN → AWS CloudFront.
Create a new IAM role
Go to IAM > Roles > Create Role. Select Custom trust policy.
Paste this trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::SITEFIRE_ACCOUNT_ID:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "UNIQUE_EXTERNAL_ID"
}
}
}
]
}Replace SITEFIRE_ACCOUNT_ID and UNIQUE_EXTERNAL_ID with the values from the Sitefire setup wizard.
Click Next.
Attach a permission policy
Click Create policy. It opens in a new tab. Switch to the JSON editor and paste:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::YOUR-LOG-BUCKET",
"arn:aws:s3:::YOUR-LOG-BUCKET/*"
]
}
]
}Replace YOUR-LOG-BUCKET with your bucket name from Step 1.
Name the policy, for example sitefireLogReaderPolicy, and save it.
Go back to the tab with the new role. Refresh the policy list and attach the new policy. Click Next.
Name and create the role
Name the role, for example sitefireLogReader. Click Create role.
Enter the details in Sitefire
Go back to the Sitefire setup wizard and click I’ve created the IAM role. Enter:
- The Role ARN from the role summary page, for example
arn:aws:iam::123456789012:role/sitefireLogReader. - Your S3 bucket name, and the prefix if you set one.
Click Connect & Import.
Sitefire tests the connection and imports the AI bot traffic of the last 7 days. The data shows in your dashboard after a few minutes.