怎么在日志里看 GPTBot 来过没有?
搜 User-Agent。nginx 和 Apache 默认的 combined 日志格式里,User-Agent 是被引号包起来的最后一段,用 awk 按引号切开取第 6 段,再统计里面出现了哪些爬虫名。下面的命令我们在本机用一份假日志实测过:
# Which AI bots hit the site, and how often (nginx or Apache "combined" log format)
awk -F'"' '{print $6}' /var/log/nginx/access.log \
| grep -o -E 'GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|Claude-SearchBot|Claude-User|PerplexityBot|Perplexity-User' \
| sort | uniq -c | sort -rn
输出是每个爬虫的请求次数,一行一个。Apache 只是日志路径不同:
# Apache: same command, different path (Debian/Ubuntu: /var/log/apache2/access.log, RHEL: /var/log/httpd/access_log)
awk -F'"' '{print $6}' /var/log/apache2/access.log \
| grep -o -E 'GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|Claude-SearchBot|Claude-User|PerplexityBot|Perplexity-User' \
| sort | uniq -c | sort -rn
看到爬虫之后,通常接着问三件事:它拿到了什么状态码,它要了哪些页面,来源 IP 是不是真的。
# What did GPTBot get back? (status code in column 9)
grep GPTBot /var/log/nginx/access.log | awk '{print $9}' | sort | uniq -c
# Which pages did GPTBot request?
grep GPTBot /var/log/nginx/access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20
状态码 200 是读到了;403 多半是被防火墙或服务器规则拦了;404 是它要的地址不存在。日志被轮转压缩成 .gz 时,用 zgrep 一起查:
# Rotated logs (.gz) as well
zgrep -h GPTBot /var/log/nginx/access.log*.gz | awk '{print $1}' | sort | uniq -c | sort -rn | head
怎么确认请求真的是官方爬虫?
用来源 IP 核对官方列表。User-Agent 是请求自己填的,谁都可以写成 GPTBot;官方爬虫则从公布的 IP 网段发出。三家都公布了 JSON 列表,下表是 2026-11-07 打开读取的结果:
| 爬虫 | 官方 IP 列表 | 我们读到时的 creationTime |
|---|---|---|
| GPTBot | https://openai.com/gptbot.json | 2026-09-22 |
| OAI-SearchBot | https://openai.com/searchbot.json | 2026-01-02 |
| ChatGPT-User | https://openai.com/chatgpt-user.json | 2026-11-06 |
| ClaudeBot、Claude-SearchBot、Claude-User | https://claude.com/crawling/bots.json | 2026-10-20 |
| PerplexityBot | https://www.perplexity.ai/perplexitybot.json | 2026-10-28 |
| Perplexity-User | https://www.perplexity.ai/perplexity-user.json | 2026-10-28 |
官方页里的 User-Agent 示例(2026-11-07 核对):
| 爬虫 | 官方页给的 User-Agent | 出处 |
|---|---|---|
| GPTBot | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot | developers.openai.com/api/docs/bots |
| OAI-SearchBot | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.4; +https://openai.com/searchbot | developers.openai.com/api/docs/bots |
| ChatGPT-User | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot | developers.openai.com/api/docs/bots |
| PerplexityBot | Mozilla/5.0 (compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot) | docs.perplexity.ai/guides/bots |
| Perplexity-User | Mozilla/5.0 (compatible; Perplexity-User/1.0; +https://perplexity.ai/perplexity-user) | docs.perplexity.ai/guides/bots |
OpenAI 和 Perplexity 的页面都写明版本号会变,所以搜日志时搜名字(GPTBot),不要搜整串。Anthropic 的帮助页我们只核对到三个名字的用途和 IP 列表地址,没有核对到完整的 User-Agent 字符串,所以不在这里列。它还提醒按 IP 拦截不一定可靠,推荐用 robots.txt 管理。各家并排对照见 AI 爬虫 User-Agent 对照表。
核对步骤:先把某个爬虫的来源 IP 去重存到文件,再用一小段 Python 比对官方网段。
grep GPTBot /var/log/nginx/access.log | awk '{print $1}' | sort -u > ips.txt
# check_ip.py: is each IP on the bot's official list? usage: python3 check_ip.py <list url> < ips.txt
import ipaddress, json, sys, urllib.request
req = urllib.request.Request(sys.argv[1], headers={"User-Agent": "ip-check"})
nets = [ipaddress.ip_network(p.get("ipv4Prefix") or p.get("ipv6Prefix"))
for p in json.load(urllib.request.urlopen(req))["prefixes"]]
for line in sys.stdin:
ip = line.strip()
if ip:
print(ip, "on list" if any(ipaddress.ip_address(ip) in n for n in nets) else "NOT on list")
python3 check_ip.py https://openai.com/gptbot.json < ips.txt
输出里 “on list” 的是官方网段内的地址,“NOT on list” 的就不是官方爬虫,可以按你的需要在防火墙里处理。列表会更新,所以每次都重新下载,别把旧网段存下来长期用。
用 Cloudflare 的话,在哪里看?
进 AI Crawl Control。Cloudflare 的文档(2026-11-07 核对)写的入口是:登录控制台,选账号和域名,打开 AI Crawl Control。Crawlers 标签列出每个 AI 爬虫的运营方、请求数、数据量和当前动作;Metrics 标签有请求随时间变化、状态码分布(2xx、3xx、4xx、5xx)、最常访问的路径,可以按爬虫、运营方、主机名、路径筛选,也能导出 CSV。文档写这个功能所有计划都可用,来源(referral)分析仅付费计划。
这里和服务器日志看到的数字不一定相同:Cloudflare 看的是经过它的请求,源站日志看的是到达源站的请求,被缓存挡住的不会进源站日志。默认会不会拦、怎么放行见 Cloudflare 默认拦 AI 爬虫吗?怎么检查和放行。网站放在 CDN 后面时,源站日志里的来源 IP 可能是 CDN 的地址,要用 CDN 传来的真实客户端 IP 字段,才能做上面的 IP 核对。
没找到记录,是为什么?
1. 先确认日志范围
日志只保留最近几天时,查不到不等于没来过。轮转后的 .gz 文件要用 zgrep 查。
2. 确认 robots.txt 没有挡住
用 AI 爬虫检查 看每个爬虫是不是“放行”,写法见 AI 爬虫的 robots.txt 怎么写。
3. 确认防火墙没有挡住
日志里的 403 说明它到了但被挡。Cloudflare 的设置见 Cloudflare 默认拦 AI 爬虫吗?怎么检查和放行。
4. 确认正文是直出的
读到页面但正文是空的,同样不会被引用,见 AI 爬虫会执行 JavaScript 吗?。
5. 记下爬虫来了,不等于被推荐
爬虫来过只是读到了页面。会不会出现在回答里,要自己去问、看来源,见 怎么衡量 AI 可见度?四个指标和一张可照做的表。点击从 AI 带来的访问见 怎么在 GA4 里看 ChatGPT 带来的访问。
各家助手的具体做法
确认爬虫来过之后,各家助手还有各自的做法:怎么让 ChatGPT 推荐我的产品、怎么让 Perplexity 推荐我的产品、怎么让 Meta AI 推荐我的产品。
常见问题
怎么知道 GPTBot 有没有爬过我的网站?
在服务器访问日志里搜 GPTBot。nginx 和 Apache 的默认日志格式里,User-Agent 在引号分隔的第 6 段,grep GPTBot 就能看到请求。再把来源 IP 和 OpenAI 官方的 gptbot.json 比对,确认是真的。
日志里完全没有 GPTBot 是什么意思?
只能说明你查的这段日志里没有。可能是爬虫还没来,也可能是日志被轮转压缩了(用 zgrep 查 .gz 文件),或者网站放在 CDN 后面、源站日志里看到的是 CDN 的地址。robots.txt 里被禁止也会让它不来。
User-Agent 能伪造吗?
能。任何人都可以把自己的请求写成 GPTBot。所以用官方公布的 IP 列表核对来源地址,不在列表里的就不是官方爬虫。
GPTBot、OAI-SearchBot、ChatGPT-User 的日志有什么区别?
OpenAI 官方页把它们分成三个:GPTBot 对应训练,OAI-SearchBot 对应 ChatGPT 的搜索,ChatGPT-User 是用户让 ChatGPT 打开网页时来。各有自己的 IP 列表。
用 Cloudflare 的话在哪里看?
官方文档写:登录 Cloudflare 控制台,选账号和域名,进 AI Crawl Control,在 Crawlers 标签里能看到每个 AI 爬虫的请求数和数据量,在 Metrics 标签里能看状态码分布和最常访问的路径。文档写这个功能所有计划都可用,来源分析仅付费计划。
出处
- OpenAI · Overview of OpenAI Crawlers (2026-11-07 核对,页面未写日期)
- Anthropic · Does Anthropic crawl data from the web, and how can site owners block the crawler? (2026-11-07 核对,页面未写发布日期)
- Perplexity · Perplexity Crawlers (2026-11-07 核对,页面未写日期)
- Cloudflare · Analyze AI traffic (2026-11-07 核对)
- OpenAI · GPTBot official IP list (2026-11-07 读取,creationTime 2026-09-22)
- Anthropic · Anthropic crawler IP list (2026-11-07 读取,creationTime 2026-10-20)
- Perplexity · PerplexityBot official IP list (2026-11-07 读取,creationTime 2026-10-28)
- kagentx 评测:案例页的数据,日期写在每个例子里。