Use CloudFront access logs and a few Amazon Athena queries to see whether OAI-SearchBot, PerplexityBot and other crawlers reach your site, which pages they fetch, which requests fail with 403 or 404, and whether AI answers send you visitors.
SEO, Technical SEO & AI Search Optimization
In an earlier article,
Is Your AWS Setup Blocking AI Search Crawlers?, we covered the three layers that decide whether AI crawlerscanreach a site on Amazon S3 and CloudFront: robots.txt, AWS WAF rules and page rendering. This article answers the next question:
are they actually visiting, what are they fetching, and are any of those requests failing? You can answer all three with data you may already have: CloudFront access logs and a few Amazon Athena queries.
1. Turn on CloudFront standard logging #
If logging isn't on yet, enable it on your distribution. CloudFront now offers
standard logging (v2), which can deliver to Amazon S3, CloudWatch Logs or Data Firehose, in formats including JSON, W3C and Parquet. The original tab-delimited logging (now called "legacy") still works, and you can run both on one distribution as long as they write to different buckets or prefixes. A few practical notes from the documentation:
-
CloudFront doesn't charge for enabling standard logs. You pay for the destination: S3 storage and requests, or CloudWatch/Firehose ingestion.
-
Logging changes can take up to 12 hours to take effect.
-
CloudFront never deletes log files, so add an S3 lifecycle rule to expire old ones.
The queries below use the legacy tab-delimited format delivered to S3, because it's the most common setup. If you use v2 with JSON or Parquet, the column names are the same idea. Athena has matching table definitions for
JSONandParquet with partition projection.
2. Create the Athena table #
This is the table definition from the
Athena documentation for CloudFront standard logs. Replace the bucket path with yours:
CREATE EXTERNAL TABLE IF NOT EXISTS cloudfront_standard_logs ( `date` DATE, time STRING, x_edge_location STRING, sc_bytes BIGINT, c_ip STRING, cs_method STRING, cs_host STRING, cs_uri_stem STRING, sc_status INT, cs_referrer STRING, cs_user_agent STRING, cs_uri_query STRING, cs_cookie STRING, x_edge_result_type STRING, x_edge_request_id STRING, x_host_header STRING, cs_protocol STRING, cs_bytes BIGINT, time_taken FLOAT, x_forwarded_for STRING, ssl_protocol STRING, ssl_cipher STRING, x_edge_response_result_type STRING, cs_protocol_version STRING, fle_status STRING, fle_encrypted_fields INT, c_port INT, time_to_first_byte FLOAT, x_edge_detailed_result_type STRING, sc_content_type STRING, sc_content_len BIGINT, sc_range_start BIGINT, sc_range_end BIGINT)ROW FORMAT DELIMITEDFIELDS TERMINATED BY '\t'LOCATION 's3://your-log-bucket/cloudfront/'TBLPROPERTIES ('skip.header.line.count'='2');
date is a reserved word in Athena, so put it in double quotes in your queries.
3. See which crawlers visit and how their requests end #
This query groups the last 30 days of requests by crawler and shows how many succeeded, were blocked or hit a missing page:
WITH bots AS ( SELECT cs_uri_stem, sc_status, CASE WHEN cs_user_agent LIKE '%OAI-SearchBot%' THEN 'OAI-SearchBot' WHEN cs_user_agent LIKE '%ChatGPT-User%' THEN 'ChatGPT-User' WHEN cs_user_agent LIKE '%GPTBot%' THEN 'GPTBot' WHEN cs_user_agent LIKE '%PerplexityBot%' THEN 'PerplexityBot' WHEN cs_user_agent LIKE '%ClaudeBot%' THEN 'ClaudeBot' WHEN cs_user_agent LIKE '%Googlebot%' THEN 'Googlebot' WHEN cs_user_agent LIKE '%bingbot%' THEN 'bingbot' WHEN cs_user_agent LIKE '%Applebot%' THEN 'Applebot' END AS bot FROM cloudfront_standard_logs WHERE "date" >= current_date - INTERVAL '30' DAY)SELECT bot, COUNT(*) AS requests, COUNT(DISTINCT cs_uri_stem) AS unique_paths, SUM(CASE WHEN sc_status = 200 THEN 1 ELSE 0 END) AS ok_200, SUM(CASE WHEN sc_status = 403 THEN 1 ELSE 0 END) AS forbidden_403, SUM(CASE WHEN sc_status = 404 THEN 1 ELSE 0 END) AS not_found_404FROM botsWHERE bot IS NOT NULLGROUP BY botORDER BY requests DESC;
How to read the result:
-
No rows for OAI-SearchBot or PerplexityBot at all. The crawler either isn't finding your site or is being turned away before it gets far. Check robots.txt and WAF, as covered in theprevious article .
-
Many 403s. When AWS WAF blocks a request, CloudFront returns 403 by default. Compare the timestamps with your WAF logs to find the rule responsible.
-
Many 404s. The crawler is following old or broken URLs. Fix the links or add redirects for pages that moved.
-
Mostly 200s. Access is working. If you still don't appear in AI answers, the issue is your content, not your infrastructure (see section 6).
The
CASE order matters: ChatGPT-User and OAI-SearchBot are checked before GPTBot , so each request lands in exactly one bucket. Add other crawlers you care about the same way.
4. See which pages AI search crawlers fetch #
SELECT cs_uri_stem, COUNT(*) AS requests, MAX("date") AS last_seenFROM cloudfront_standard_logsWHERE "date" >= current_date - INTERVAL '30' DAY AND cs_user_agent LIKE '%OAI-SearchBot%' AND sc_status = 200GROUP BY cs_uri_stemORDER BY requests DESCLIMIT 50;
Compare the list with the pages that matter most to your business: service pages, pricing and contact. If the crawler spends its visits on tag archives, search pages or old campaign URLs, tighten your internal links and sitemap so the important pages are easy to reach. Swap in
PerplexityBot or any other user agent to run the same check.
It's also worth confirming crawlers can read robots.txt itself:
SELECT "date", time, sc_status, cs_user_agentFROM cloudfront_standard_logsWHERE cs_uri_stem = '/robots.txt' AND "date" >= current_date - INTERVAL '7' DAYORDER BY "date" DESC, time DESCLIMIT 100;
Anything other than 200 here (especially a 403 or a 200 that returns your HTML homepage) means crawlers can't read your rules.
5. Make sure the visitor is really the crawler #
User-agent strings are easy to fake, and scrapers often pretend to be well-known bots. Before you add an allow rule because of what you see in logs, check the
c_ip values against the IP ranges each company publishes. OpenAI lists the ranges for OAI-SearchBot, GPTBot and ChatGPT-User on its crawler overview page, and Google, Microsoft, Apple and Perplexity publish theirs in their crawler documentation.
If you use AWS WAF Bot Control, it already does this verification for its "verified bot" labels, and the
AWS WAF AI activity dashboardgives a quick view of AI bot traffic without writing queries. The Athena approach is still useful when WAF isn't in front of your site or you want history beyond what the dashboard shows.
6. Check whether AI answers send you visitors #
Crawler visits are only half the picture. The other half is people clicking through from AI answers. This query counts HTML page views referred by ChatGPT or Perplexity:
SELECT "date", COUNT(*) AS visitsFROM cloudfront_standard_logsWHERE "date" >= current_date - INTERVAL '30' DAY AND sc_content_type LIKE 'text/html%' AND (cs_referrer LIKE '%chatgpt.com%' OR cs_referrer LIKE '%perplexity.ai%' OR cs_uri_query LIKE '%utm_source=chatgpt.com%')GROUP BY "date"ORDER BY "date";
Treat the result as a minimum. Some apps don't pass a referrer, and the way AI tools tag their links has changed more than once, so part of this traffic shows up as "direct" in any analytics tool.
If crawlers fetch your pages successfully but you rarely see referrals or mentions, the next step is content and reputation rather than infrastructure: clear service pages, consistent business listings and trusted mentions on other sites. We wrote a step-by-step guide on that side of the work:
How to Rank in ChatGPT: Get Your Business Recommended.
7. Keep Athena costs low #
Athena charges by the amount of data each query scans. The legacy table above isn't partitioned, so every query reads every log file in the bucket. To keep costs down:
-
Always filter by
"date"and addLIMITwhile exploring. -
Expire old logs with an S3 lifecycle rule.
-
For busy sites, switch to standard logging v2 with Parquet output and a partitioned Athena table , so queries read only the days they need.
Quick checklist #
-
CloudFront standard logging is on, with a lifecycle rule for old files.
-
The Athena table points at your log bucket.
-
OAI-SearchBot, PerplexityBot and the search engine crawlers appear in your logs.
-
Their requests are mostly 200s, not 403s or 404s.
-
/robots.txtreturns 200 to crawlers. -
The pages crawlers fetch match the pages that matter to your business.
-
Suspicious "bot" traffic is checked against published IP ranges before you allow it.
-
Referrals from AI answers are tracked, even if the numbers are a floor.
Written by Los Angeles SEO Inc, an AI search and growth marketing agency in Los Angeles. Founded in 2013 by Sasan Raeisi.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
recommendations