How to Read AI Crawlers in Server Logs: Requests and Bytes

Published:

10 minute read

Acar Diveroli
Written by: Acar Diveroli
Two cards tilted forward, an access log line and an IP list; request, byte and status badges on top, a blue IP check badge

A server log (access log) is the file that records every request to your site with its IP, path, status code, bytes sent and user-agent. To read AI crawlers, you group the lines by the bot name in the user-agent and add up requests and bytes. The trap is that a user-agent is not proof. Not every request that says GPTBot comes from OpenAI. This post covers the fields of a log line, counting per bot, verification against official IP lists and how to read the output.

The combined log line

Nginx and Apache write the "combined" format by default. In Nginx, the format is defined like this:

nginx
log_format combined '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent"';

So a line from an AI crawler carries seven pieces of information. The lines below are synthetic. They come from a sample log we generated for this post and do not belong to a real site:

text
20.171.206.77 - - [03/Dec/2026:09:12:57 +0300] "GET /old-campaign HTTP/1.1" 404 153 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot"
18.97.9.168 - - [03/Dec/2026:09:04:19 +0300] "GET / HTTP/1.1" 200 41000 "-" "CCBot/2.0 (https://commoncrawl.org/faq/)"

For traffic, the field to look at is the number after the status code. According to the Nginx docs, $body_bytes_sent is the number of bytes sent to the client, not counting the response headers. The Apache equivalent is the %b field. When the body is empty, Apache writes - instead of 0. Count that dash as zero when you add things up.

This number is not the size of the page on disk. It is the body sent in that request. A 304 Not Modified response sends no body, and the field is zero or a dash. For real network traffic including headers, Apache needs the %O field from mod_logio.

A one-line count

For a first look, awk is enough. In the combined format, the tenth field is the byte count and the ninth is the status code:

bash
awk '/GPTBot/ {n++; s+=$10} END {print n, s}' access.log
grep GPTBot access.log | awk '{print $9}' | sort | uniq -c

In our sample log, the first command returned 85 requests and about 23.7 MB. That figure is misleading. Of the 85 requests, 25 carried the GPTBot name but did not come from OpenAI's addresses. Any client can write whatever it likes in the user-agent header. If you will base a decision on the count, verify the IP first.

Official IP lists

Some AI companies publish their crawlers' outbound addresses as JSON files. The files share one structure: a prefixes array, with ipv4Prefix or ipv6Prefix in each element. On December 3, 2026, we found each one on its official page and downloaded it:

CompanyBotList
OpenAIGPTBot, OAI-SearchBot, ChatGPT-UserA separate JSON per bot
AnthropicClaudeBot, Claude-SearchBot, Claude-UserOne JSON for all three
PerplexityPerplexityBot, Perplexity-UserA separate JSON per bot
AppleApplebotJSON, plus reverse DNS
Common CrawlCCBotJSON, reverse DNS for IPv4
Metameta-externalagentNo list in the crawler docs

Anthropic's list verifies the company, not the type of bot. All three bots can come from the same address range. Apple's Applebot-Extended never shows up in a log at all. According to Apple, it does not crawl pages. It is only a robots.txt token that controls how the data is used. We explain which token does what in our post How to Manage AI Crawlers with robots.txt.

Meta's crawler docs do not publish an IP list. In that case you look up the owner of the IP's network. We showed the method in our post on Meta's web crawlers. Do not count a bot without a list as verified. In the script these lines stay separate as unverifiable.

Requests and bytes per bot

The script below reads one or more combined logs. It also opens rotated .gz files. For each AI crawler it prints the request count, the byte total and the status code classes. It labels each IP as genuine, spoofed or unverifiable against the company's list. Finally, it lists the five paths genuine bots requested most:

python
import gzip
import ipaddress
import json
import re
import sys
import urllib.request
from collections import Counter, defaultdict

# token: (company, official IP list or None)
BOTS = {
    "GPTBot": ("OpenAI", "https://openai.com/gptbot.json"),
    "OAI-SearchBot": ("OpenAI", "https://openai.com/searchbot.json"),
    "ChatGPT-User": ("OpenAI", "https://openai.com/chatgpt-user.json"),
    "ClaudeBot": ("Anthropic", "https://claude.com/crawling/bots.json"),
    "Claude-SearchBot": ("Anthropic", "https://claude.com/crawling/bots.json"),
    "Claude-User": ("Anthropic", "https://claude.com/crawling/bots.json"),
    "PerplexityBot": ("Perplexity", "https://www.perplexity.ai/perplexitybot.json"),
    "Perplexity-User": ("Perplexity", "https://www.perplexity.ai/perplexity-user.json"),
    "Applebot": ("Apple", "https://search.developer.apple.com/applebot.json"),
    "CCBot": ("Common Crawl", "https://index.commoncrawl.org/ccbot.json"),
    "meta-externalagent": ("Meta", None),  # no JSON list
}
LINE = re.compile(
    r'^(\S+) \S+ \S+ \[[^\]]+\] "(?:\S+) (\S+)[^"]*" (\d{3}) (\d+|-) "[^"]*" "([^"]*)"'
)


def fetch_list(url, cache={}):
    if url not in cache:
        req = urllib.request.Request(url, headers={"User-Agent": "log-check/1.0"})
        with urllib.request.urlopen(req, timeout=30) as r:
            data = json.load(r)
        cache[url] = [
            ipaddress.ip_network(p.get("ipv4Prefix") or p["ipv6Prefix"])
            for p in data["prefixes"]
        ]
    return cache[url]


def find_bot(ua):
    lower = ua.lower()
    for token in BOTS:
        if token.lower() in lower:
            return token
    return None


def verify(token, ip):
    url = BOTS[token][1]
    if url is None:
        return "unverifiable"
    addr = ipaddress.ip_address(ip)
    return "genuine" if any(addr in net for net in fetch_list(url)) else "spoofed"


def open_log(path):
    return gzip.open(path, "rt", encoding="utf-8", errors="replace") if path.endswith(".gz") \
        else open(path, encoding="utf-8", errors="replace")


hits = Counter()
sent = Counter()
status = defaultdict(Counter)
path_hits = Counter()
path_bytes = Counter()
for name in sys.argv[1:]:
    with open_log(name) as f:
        for line in f:
            m = LINE.match(line)
            if not m:
                continue
            ip, path, code, size, ua = m.groups()
            token = find_bot(ua)
            if token is None:
                continue
            key = (token, verify(token, ip))
            n = 0 if size == "-" else int(size)  # Apache writes "-" for 0 bytes
            hits[key] += 1
            sent[key] += n
            status[key][code[0] + "xx"] += 1
            if key[1] == "genuine":
                path = path.split("?")[0]  # drop the query string
                path_hits[path] += 1
                path_bytes[path] += n

print(f"{'bot':<20}{'identity':<15}{'requests':>9}{'MB':>8}  status codes")
for key in sorted(hits, key=sent.get, reverse=True):
    codes = " ".join(f"{k}:{n}" for k, n in sorted(status[key].items()))
    print(f"{key[0]:<20}{key[1]:<15}{hits[key]:>9}"
          f"{sent[key] / 1e6:>8.2f}  {codes}")

print("\nTop paths requested by genuine bots:")
for path, n in path_hits.most_common(5):
    print(f"{n:>5} requests {path_bytes[path] / 1e6:>7.2f} MB  {path}")

Run the script as python ai_bots.py access.log access.log.1.gz. On the synthetic 300-line sample log, the output was:

text
bot                 identity        requests      MB  status codes
GPTBot              genuine               60   18.19  2xx:37 3xx:5 4xx:18
ClaudeBot           genuine               40   18.14  2xx:31 3xx:7 4xx:2
CCBot               genuine               20    7.72  2xx:13 3xx:2 4xx:5
meta-externalagent  unverifiable          14    7.57  2xx:9 3xx:2 4xx:3
GPTBot              spoofed               25    5.50  2xx:17 3xx:4 4xx:4
Applebot            genuine               12    5.29  2xx:10 3xx:1 4xx:1
ClaudeBot           spoofed               10    5.22  2xx:8 3xx:1 4xx:1
ChatGPT-User        genuine                6    2.59  2xx:5 4xx:1
PerplexityBot       genuine               15    0.69  2xx:13 3xx:1 4xx:1
OAI-SearchBot       genuine               18    0.60  2xx:11 3xx:2 4xx:5

Top paths requested by genuine bots:
   34 requests    1.84 MB  /products
   22 requests   48.00 MB  /pdf/catalog-2026.pdf
   19 requests    0.99 MB  /blog/nginx-cache
   18 requests    0.00 MB  /old-campaign
   17 requests    0.16 MB  /sitemap.xml

The figures belong to the sample log. They say nothing about the real traffic of any site or bot.

Reading the output

The request count and the byte total tell you different things. In the sample, ClaudeBot sent 40 requests and GPTBot 60, yet their byte totals came out almost the same. The difference comes from which files were requested. Answer bandwidth questions with the byte column, not the request count.

The path list shows where the bytes went. In the sample, 22 PDF requests carried 48 MB, while the most requested path stayed under 2 MB. In a table like this, the fix is often on a single path. Caching or compressing the large file has fewer side effects than shutting the bot out.

Status codes tell you what the bot found:

  • Many 404s. The bot is walking an old list of links. In the sample, /old-campaign was requested 18 times. If the page moved, return 301. If it is gone for good, return 410.
  • 304. Conditional requests work. The bot sends If-Modified-Since or If-None-Match, and the server does not send the body again.
  • 429. Your own rate limit is kicking in. If you set it too tight for genuine bots, your visibility on the search side can suffer.
  • 5xx. The problem is on the server. If you return errors under bot load, look at those paths first.

spoofed lines do not belong to the company. Manage them by your own bot rules, not by the company's policy. We covered the debate over how much of all traffic comes from bots in How Much Web Traffic Is Bots?.

Your own bot's footprint

When you collect data, the same lines land in another server's log. If you use a proxy, that log shows the proxy's exit IP, not yours. The user-agent, though, is the text you wrote. A user-agent with your name and a contact address makes it easier for the site owner to recognize you.

Borrowing an AI crawler's name gets you nothing. Your exit IP is not on the company's list, so the script above labels you spoofed. The same rule applies to bytes: send If-Modified-Since, and an unchanged page returns 304 with an empty body. Follow the site's terms and robots.txt. For legitimate collection that needs a location, use Residential Proxy. When speed and volume come first, datacenter IPs are enough.

Troubleshooting

  • Every line is spoofed. Your server sits behind a CDN or a load balancer. $remote_addr shows the server in between, not the real client. In Nginx, enable the realip module only for the CDN addresses you trust, and log the real IP that way.
  • The script counts no lines. Your log format is not combined. A field added at the start or end (response time, host) breaks the regular expression. Look at your log_format line and adjust the LINE pattern to match.
  • The byte total is lower than expected. If the CDN answered from cache, the request never reaches the origin server's log. For real traffic, look at the CDN's own logs.
  • A list will not download. Some endpoints may reject the default Python user-agent. That is why the script sends its own. If the error persists, open the address in a browser and check where the file lives.
  • A bot that was genuine yesterday is spoofed today. The lists change. Each file has a creationTime field at the top. Do not keep a permanent copy of the list. Download it on every run.

How we tested

We ran the test on December 3, 2026, on Windows 11 with Python 3.13.17. First we generated a 300-line synthetic combined log with a fixed seed. We picked the IPs for genuine lines from the official lists we downloaded that day. For spoofed lines we used 203.0.113.0/24 and 198.51.100.0/24, the ranges reserved for documentation. We ran the script on both the plain file and a gzip copy, and the two outputs matched. We tried the awk commands with GNU Awk 5.4.1. We did not set up a web server. For field definitions we relied on the Nginx and Apache docs.

The bottom line

When counting AI crawlers, group by user-agent, verify the IP against the official list, and read bandwidth from the byte column and the path list. When you run your own bot, use an honest user-agent and conditional requests. The same rule holds for collection with Datacenter Proxy. Above all, do not put a company name on a line you have not verified.

Sources

Frequently asked questions

How do I measure AI crawler bandwidth?

By adding up the byte field. In a combined log, the number after the status code is the size in bytes of the body sent in that request. Group the bots by user-agent and sum this field, and you get the body traffic each bot carried. Headers are not included in this number. For network traffic including headers, you need to enable the %O field with mod_logio in Apache.

How do I know a request that says GPTBot is real?

By comparing its IP with OpenAI's list. OpenAI publishes a separate JSON file for each bot, openai.com/gptbot.json for GPTBot. If the request's IP falls inside one of the ranges in that file, the request comes from OpenAI. If not, it is another client using the name. Download the list again for every check, because the ranges change over time.

Which AI companies publish IP lists?

OpenAI, Anthropic, Perplexity, Apple and Common Crawl publish JSON lists on their official pages as of December 3, 2026. Amazon gives Amazonbot's addresses on a separate page. Meta's crawler docs have no IP list. Do not count a line from a bot without a list as verified. Look up the network owner or keep it in a separate group.

If my server is behind a CDN, is the IP in the log correct?

No, not with the default setup. The origin server gets the connection from the CDN, so $remote_addr shows the CDN's address. In that case every AI crawler looks spoofed. You need to take the real client IP from the header the CDN adds and write it to the log. In Nginx, the realip module does this. Configure it to trust only the CDN addresses.

How do I see which pages a bot requests most?

By counting the path in the request line. In a combined log, the second word inside the first quotes is the requested path. Drop the query string and merge identical paths, and you get a per-page list. Adding each path's byte total next to it makes rarely requested but large files visible. Bandwidth is often spent on exactly those files.

Why does Applebot-Extended never show up in the log?

Because it does not crawl pages. According to Apple, Applebot-Extended is a robots.txt name that controls whether data collected by Applebot may be used to train models. The requests show up in the log under the Applebot name. So there is nothing to count for Applebot-Extended. Verification runs on the Applebot lines, with Apple's JSON list or a reverse DNS check against applebot.apple.com.

Ask ChatGPTAsk Claude