Verify AI crawler traffic in server logs
Short answer
User-agent strings can be faked, so count only verified crawler requests. Check Google with reverse-then-forward DNS or its published IP lists, and Baidu with reverse DNS. OpenAI, Perplexity and Anthropic publish IP lists for their crawlers.
Before you start
Section titled “Before you start”- Access to raw server or CDN logs with the client IP address and user-agent of each request.
- A shell with
host(ordig) for DNS lookups, or a script that can fetch JSON and match IPs against CIDR ranges.
1. Google: reverse, then forward DNS
Section titled “1. Google: reverse, then forward DNS”host 66.249.66.1 # → crawl-66-249-66-1.googlebot.comhost crawl-66-249-66-1.googlebot.com # → 66.249.66.1 (must match)Google publishes the lists as JSON files per crawler category (common crawlers, special-case crawlers, user-triggered fetchers), linked from its verification page.
2. OpenAI and Perplexity: published IP ranges
Section titled “2. OpenAI and Perplexity: published IP ranges”Each file lists CIDR prefixes. A request is verified when its user-agent names the crawler and its IP falls inside one of that crawler’s prefixes.
3. Anthropic
Section titled “3. Anthropic”4. Baidu: reverse DNS
Section titled “4. Baidu: reverse DNS”host 123.125.66.120 # → Baiduspider-123-125-66-120.crawl.baidu.comBaidu’s FAQ stops at the reverse lookup. Adding the forward lookup used for Google costs nothing and also catches a spoofed PTR record.
5. 360 and Toutiao: published IP ranges
Section titled “5. 360 and Toutiao: published IP ranges”That list is from 2019 and has no machine-readable version, so treat a mismatch as “unverified”, not as proof of a fake.
Verify
Section titled “Verify”- Spot-check: pick a request from each claimed crawler and run the check by hand.
- In reports, separate claimed from verified crawler traffic. Unverified requests with a crawler’s user-agent are a different population and shouldn’t be counted as that crawler.
Rollback
Section titled “Rollback”Verification is read-only. If you added firewall rules based on it, remove them and fall back to robots.txt rules (Configure robots.txt for AI crawlers).
Common mistakes
Section titled “Common mistakes”- Trusting the user-agent string alone.
- Caching IP lists forever. The files carry a
creationTimeand change over time; refresh them on a schedule. - Blocking unverified “Googlebot” traffic by user-agent string. It blocks nothing once the impostor changes its string. Meanwhile, IP-based blocking of real crawlers can stop them from reading your robots.txt.