Key takeaways
  • A user-agent string is a claim. Only the client IP can back it up.
  • Reverse DNS followed by forward confirmation verifies Googlebot and Bingbot without vendor cooperation.
  • Published IP ranges cover OpenAI's crawlers. Treat a claimed bot outside its range as spoofed.

The short answer

A user-agent string is a claim, not evidence. When a log line says GPTBot, that means the client chose to send that word. To know who actually made the request, check the client IP against something the crawler's operator controls: a reverse DNS record that resolves into the company's domain, or an IP range the company publishes. Use the user-agent to sort traffic into groups. Use the IP to decide whether you believe the group label.

Most sites get this backwards. They count bot hits by user-agent, write allowlist rules by user-agent, and report the totals as if they were measurements. The fix is small: verify before you trust.

Why user-agent strings are spoofable

The User-Agent header is a string the client sends with every request. The client writes it. Any HTTP library can send any value, and a one-line curl command with a chosen agent string does it in a flag. Scrapers copy Googlebot's string because many sites serve it pages that ordinary visitors never see, and some scrapers copy AI crawler names because those names look routine in a log.

This is not hypothetical in your logs. Look at any busy site for a week and you will find Googlebot coming from cloud virtual machines, residential blocks, and addresses in countries where Google does not run crawlers. You will also find ClaudeBot and PerplexityBot lines from IPs that belong to hosting providers unrelated to those companies. The header tells you what the client wanted you to think. It tells you nothing about where the request came from.

Two rules follow from this. Do not write firewall or WAF rules that allow a bot by user-agent, because a rule that says allow GPTBot lets through anyone who types GPTBot. And do not report bot counts from user-agent matching as crawl activity; label those numbers claimed until they are verified. A claimed count is still useful, because it tells you which traffic to check.

The order matters. Filter by user-agent first, because it is cheap and it narrows the set. Verify by IP second, because that is the step that carries weight.

Reverse DNS and forward confirmation

Google documents a two-step check for Googlebot and its other crawlers. Bingbot can be verified the same way, with a different domain. The method needs no vendor cooperation, only DNS.

Step one is the reverse lookup. Take the client IP and read its PTR record. For a real Googlebot the hostname ends in googlebot.com or google.com. Step two is forward confirmation. Resolve that hostname back to an address, and check that the address equals the original client IP.

Both steps are needed. The PTR record belongs to whoever holds the IP block, so a hostile operator with that block can publish any name they like, including one that looks like Google's. The forward lookup closes that gap. A hostname under googlebot.com resolves to an IP only if Google's own DNS says so. An attacker who controls the IP block cannot change Google's forward records.

Here is the check by hand, using an address from a Googlebot range:

$ host 66.249.66.1
1.66.249.66.in-addr.arpa domain name pointer crawl-66-249-66-1.googlebot.com.
$ host crawl-66-249-66-1.googlebot.com
crawl-66-249-66-1.googlebot.com has address 66.249.66.1

The reverse record ends in googlebot.com, and the forward lookup returns the same IP. That is a verified Googlebot. If the forward lookup returns a different address, or no address, the claim fails, even if the reverse record looks right.

Running that by hand for every IP is slow. This script reads IPs from stdin and checks each one. It takes the allowed domain as an argument so you can reuse it for Bingbot:

#!/usr/bin/env bash
# usage: sort -u claimed-ips.txt | ./verify-rdns.sh '(googlebot|google)\.com'
allowed="$1"

while read -r ip; do
  ptr=$(host "$ip" 2>/dev/null | awk '/domain name pointer/ {sub(/\.$/, "", $NF); print $NF}')

  if [[ -z "$ptr" ]] || ! [[ "$ptr" =~ \.(${allowed})$ ]]; then
    echo "FAIL  $ip  ptr=${ptr:-none}"
    continue
  fi

  fwd=$(host "$ptr" 2>/dev/null | awk '/has address/ {print $NF}')
  if grep -qx "$ip" <<< "$fwd"; then
    echo "OK    $ip  $ptr"
  else
    echo "FAIL  $ip  forward-mismatch"
  fi
done

The script needs host, which comes from the bind-utils or dnsutils package on most Linux systems. Run it on a unique IP list, not the raw log. A busy site has thousands of repeated addresses, and each DNS lookup takes time. Keep the output in a file and reuse it, because a verified IP stays verified for a long time in practice, though you should still re-check periodically.

Bing's crawler uses reverse names under search.msn.com, so the same script with that pattern works for Bingbot. Check Microsoft's current webmaster documentation for the exact domain before you rely on it.

Published IP ranges

Some operators publish the IP ranges their crawlers use. This is the second method, and it is the only one available when the operator's IPs do not resolve to tidy reverse names.

Google publishes JSON files for Googlebot and its other crawlers in its developer documentation. OpenAI publishes separate JSON files for GPTBot, OAI-SearchBot and ChatGPT-User on its own domain. Anthropic and Perplexity document their crawlers too. The exact file paths change, so look them up in each vendor's crawler documentation before you script against them. Do not hardcode a URL you copied from an old blog post, this one included.

Once you have a range file, the check is a containment test. Test an address against it with Python's standard library. The -I flag stops Python from loading any module from the current directory, which matters when you are reading a file someone else published:

python3 -I -c '
import ipaddress, sys
ip = ipaddress.ip_address(sys.argv[1])
nets = [ipaddress.ip_network(l.strip()) for l in open(sys.argv[2]) if l.strip()]
print("in-range" if any(ip in n for n in nets) else "outside")
' 203.0.113.9 gptbot.cidr

The address 203.0.113.9 is from a documentation range, so the script prints outside. A real visitor that claims GPTBot and falls outside the published range is spoofed. A visitor inside the range is probably the real crawler, though a range is a coarse check: it shows the IP is in the operator's block, not that the specific request came from the crawler's software.

Use ranges as a second signal when reverse DNS is unavailable, and combine them with the user-agent. The strongest result is a claimed GPTBot inside OpenAI's range. The weakest result is a claimed GPTBot outside every range. Most log lines fall between those two, and you should record the result rather than forcing a yes or no.

Finding AI bots in your logs

These examples assume nginx with the combined log format, where the fields are separated by spaces and the quoted fields are the request, the referrer and the user-agent. If your format differs, adjust the field numbers. Splitting on the double quote character is the most reliable approach, because it keeps the user-agent intact even when it contains spaces.

Start with the overall picture. This counts claimed AI and search bot hits by name and status code:

awk -F'"' '
  match($6, /GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|PerplexityBot|Googlebot|bingbot/) {
    split($3, s, " ")
    print substr($6, RSTART, RLENGTH), s[1]
  }' /var/log/nginx/access.log | sort | uniq -c | sort -rn

Each output line is a count, a claimed bot name and a status code. Read it as a list of claims. A large count of OAI-SearchBot 200 tells you that a claimed search crawler is getting pages. A large count of GPTBot 403 tells you something about your rules.

Next, pull the IPs that claim one bot. This is your verification queue:

grep 'GPTBot' /var/log/nginx/access.log \
  | awk '{print $1}' | sort | uniq -c | sort -rn | head -20

Take the top addresses, run them through the reverse DNS script or the range check, and note which ones fail. To build a clean list of unique claimed IPs across several bots, write them to a file once and reuse it:

grep -E 'GPTBot|ClaudeBot|PerplexityBot|Googlebot' /var/log/nginx/access.log \
  | awk '{print $1}' | sort -u > claimed-ips.txt

Finally, see what the bots are requesting. Crawl patterns tell you more than volume does. If a crawler spends its requests on parameterized search URLs, faceted filters or old redirects, you have a crawl budget problem that no amount of verification will fix. Verification tells you whether the crawler is real. The path list tells you whether it is worth your server time.

Reading status codes: 403 and 429

Status codes are where verification turns into a decision. The same claimed bot can produce different codes for different reasons, and the reason determines the fix.

A 200 from a verified crawler means the crawl is working. Confirm that the pages returning 200 are the ones you want indexed. A 200 from an unverified claim means a spoofer or a scraper got through, which is a rule problem if you were trying to block it.

A 403 usually comes from a firewall, a WAF or a CDN rule. It is the right answer for an unverified IP that claims a bot you do not want. It is a bug for a verified IP. If your rule refuses real Googlebot because its user-agent string matched a suspicious pattern, you have a rule to fix, and you should fix it before the next crawl cycle.

A 429 means the client exceeded a rate limit. For a verified crawler, that is a signal to slow it down, not to block it. Google's crawl documentation says Googlebot reduces its crawl rate when a site responds with 429 or 503, so a deliberate rate limit is a valid way to control load. A blanket block teaches the crawler nothing and can drop pages from the index. Check whether the 429s cluster in one hour or one day. A cluster usually means a crawler found a set of expensive pages, and the fix is to make those pages cheaper or to exclude them.

Also check your robots.txt. If the robots file returns a 403, 429 or 5xx, compliant crawlers may stop fetching the rest of the site, and the log will show a sudden drop in everything else. Confirm the file returns 200 for each bot in the logs. It is the cheapest check in this article and the one most often skipped.

Turning logs into a monitoring habit

One verification run tells you what happened last week. A habit tells you when something changes. The goal is a short routine that runs on a schedule and produces only the alerts that need a person.

A workable version looks like this. Weekly, run the claimed IP list through verification for each bot, and keep the verified results in a file so you do not repeat DNS lookups. Weekly, compare the status code mix for each verified bot against the week before; a rise in 403s or 429s from verified crawlers is worth a look, and a drop in 200s from Googlebot is worth a look the same day. Monthly, review the paths each bot requests and compare them to the pages you want indexed. Keep robots.txt in version control, so that when a bot's behavior changes you know whether your file changed too. And keep logs for at least 30 days, which is enough for weekly and monthly comparisons.

Alerts should be few. Good candidates are a verified crawler receiving more than a small share of 403s, a verified crawler receiving a sustained 429 cluster, and a claimed bot with unverified IPs reaching pages that were meant to be closed. Alerts that fire on every new user-agent string become noise within a week.

This is also where per-URL bot logging helps. InstantIndexingPro records which bots hit which URL and the status each one received, so the path list and status mix above are a filter on a dashboard rather than a set of commands you run after an incident. You can still do the whole job by hand on your own logs, and you should understand the commands even if you use a tool for them.

The point of the habit is not perfect verification. It is knowing, on any given week, which AI crawlers reached your pages, which ones you trust, and which ones your rules are pushing away. Start with the verification script on the top 20 IPs for your busiest bot, write down what fails, and fix the one rule that causes the most 403s. That single pass will teach you more about your traffic than a month of user-agent counts.