Written by: Content & GEO Research
Fastlook Team
Most teams never look at who actually requests their pages from which country. Analyze server log files for geo targeting and you see exactly which regional visitors and AI crawlers reach your content, what they get back, and where they stop. This page walks through the full pipeline: field extraction, IP geolocation, bot verification, and country-level filtering.
Quick answer
You need five fields: the user agent, timestamp, request path, status code and client IP. The user agent identifies crawlers such as GPTBot, ClaudeBot and PerplexityBot. The request path shows coverage, meaning which URLs they reach.
- Topic
- analyze server log files for geo targeting
- Last updated
- Nov 22, 2026
- Read time
- 7 min
Key Takeaways
- Analytics tools miss much of what happens on your server.
- The real client IP is the visitor's address, not the address of an intermediate proxy.
- Geolocation maps each IP to a country, city and network owner.
- A user agent string claiming to be Googlebot or GPTBot is not proof of identity, because user agents are trivially spoofed.
- Run the analysis in three passes, as Fastlook describes for GEO log work.
- 1Key Takeaways
- 2Why geo targeting depends on raw request data
- 3Which log fields do you need to identify AI crawlers?
- 4Extract the real client IP behind proxies and CDNs
- 5How do you geolocate IPs and which geo fields should you add?
- 6Is that Googlebot or GPTBot really the crawler it claims to be?
Why geo targeting depends on raw request data
Analytics tools miss much of what happens on your server. Server logs are written server-side and record requests from clients that never execute JavaScript, so they capture crawler traffic that script-based tracking skips. According to Lumetraffic, standard Combined Log Format lines hold the client IP, timestamp, method, path, status code, bytes sent, referrer and user agent. Those fields are enough to ask a precise question:
- Which countries
- Which bots operating from them
- Request which URLs
- What status codes they receive
Without that raw record, regional targeting is guesswork.
Which log fields do you need to identify AI crawlers?
Start with four fields. The user agent identifies the crawler family, such as GPTBot, ClaudeBot or PerplexityBot, which are named in each log line. The timestamp shows crawl frequency over time. The request path shows coverage, meaning which URLs those bots hit and which they never touch.
The status code exposes 404 errors, 5xx server errors and redirect chains that bots receive. Keep the client IP as well, because geolocation and bot verification both depend on it. According to the Semji guide to log analysis for GEO, Search Console does not track AI bots, so server logs are the only raw source of truth for this activity.
Extract the real client IP behind proxies and CDNs
The real client IP is the visitor's address, not the address of an intermediate proxy. A script that reads the first field as the IP works on standard Nginx Combined logs, according to the geoip-log-analyzer README. However, custom Apache or JSON logs may require changing the ip = line_parts[0] extraction line. Behind a load balancer or CDN, the first field is often the proxy, not the visitor. Specifically, Rheinwunder notes that load balancers may pass the real client IP only in an additional header field. Check your X-Forwarded-For or CDN equivalent before trusting any country count.
Map your format before you run anything:
- Nginx Combined: client IP is the first field
- Behind a CDN: read the forwarded client IP header
- Custom or JSON logs: edit the extraction step to match the schema
How do you geolocate IPs and which geo fields should you add?
Geolocation maps each IP to a country, city and network owner. The geoip-log-analyzer script uses a MaxMind GeoIP2 Country database, such as the free GeoLite2 Country.mmdb file, and requires Python 3.9 or higher, per its README. Enrichment should go further. ipgeolocation.io's guide on enriching server logs recommends adding ASN, organisation and security flags such as VPN, proxy or datacenter status. Because a million log lines usually map to only tens of thousands of unique IPs, deduplicate addresses before lookups to save requests.
| Geo field | Why it matters for geo targeting |
|---|---|
| Country | Shows which markets request your pages |
| City | Refines regional demand within a country |
| ASN / organisation | Identifies crawler networks and hosting providers |
| Datacenter / VPN / proxy flag | Separates real visitors from automated infrastructure |
Field list drawn from the ipgeolocation.io enrichment guidance.
Is that Googlebot or GPTBot really the crawler it claims to be?
A user agent string claiming to be Googlebot or GPTBot is not proof of identity, because user agents are trivially spoofed. Verification is required. Rheinwunder recommends checking bot requests against the providers' official IP lists and running a reverse DNS lookup on each address. Requests that claim a crawler identity but fail both tests should be discarded.
Skipping this step lets scrapers disguised as major bots enter your counts. Country-level totals of AI crawler activity then include traffic that is not from those crawlers, which distorts the regional picture you are trying to build. Verified records give you a reliable basis for every geographic conclusion.
Where should you start with a geo log analysis?
Run the analysis in three passes, as Fastlook describes for GEO log work. First, coverage: identify which URLs AI crawlers request and which they miss entirely. Second, frequency: measure how often each section of the site is crawled. Third, errors: find the 404 responses, 5xx responses and redirect chains that bots receive. According to Rheinwunder, seven to fourteen days of log data is usually enough to start. However, the data must be filtered first by verified bot and then by country before comparing results. A market generating heavy crawl activity on pages that return errors is a clear, prioritised fix. Once those gaps are known, the practical steps follow: repair broken internal links, remove redirect chains and move crawl activity away from low-value URLs.
The passes build on one another. Coverage shows where bots go, frequency shows how often they return, and errors show where those visits fail.
Sources & further reading
- GitHub - alexxphysics/geoip-log-analyzer: A lightweight Python script to parse server logs and analyze unique IP addresses by country using
- Log File Analysis: Track AI Bots & Fix Crawl Gaps
- Log analysis for GEO: what AI bots crawl, Semji
- AI Log Analyzer - Free GEO/AISEO Log Analysis Tool
- Log File Analysis for SEO and AI Crawlers
- How to Enrich Server Logs With Geolocation Data
Frequently asked questions
What log fields are needed to analyze AI crawlers?
You need five fields: the user agent, timestamp, request path, status code and client IP. The user agent identifies crawlers such as GPTBot, ClaudeBot and PerplexityBot. The request path shows coverage, meaning which URLs they reach. The status code exposes the errors bots receive. The client IP enables geolocation and bot verification. Specifically, the client IP is the field that links each request to a country and to a verified crawler identity.
How do you geolocate IP addresses in server logs?
Each IP address is mapped to a country, city and network owner using a MaxMind GeoIP2 database. The free GeoLite2 Country.mmdb file is one option for this. The geoip-log-analyzer script uses this approach and requires Python 3.9 or higher, according to its README. Once the database file is in place and the script points to it, lookups are straightforward. Specifically, the database must be a MaxMind GeoIP2 Country database for the script to work as described.
Which geo fields should you add when enriching logs?
Enrichment should add country, city, ASN and organisation to each log record. Security signals such as VPN, proxy or datacenter status should also be added. According to ipgeolocation.io, these signals help separate real visitors from automated infrastructure. Deduplicating IP addresses before looking them up reduces the number of lookups required, since a log with a million lines usually holds only tens of thousands of unique addresses.
How can you tell if a bot claiming to be Googlebot is genuine?
A bot is genuine only if its IP address passes verification. Compare the IP address against the provider's official IP list and run a reverse DNS lookup on that address. Requests that claim a crawler identity but fail both checks are likely spoofed. Exclude those requests from your counts before drawing conclusions. Rheinwunder advises this check because many bot requests claiming to be Googlebot or AI crawlers are spoofed.
Why does the first IP field sometimes show the wrong country?
Behind a load balancer or CDN, the first field may be the proxy rather than the visitor. Rheinwunder notes the real client IP may appear only in an additional forwarded field, so check that header first.
Does the standard log analysis script work on every log format?
No, it does not work on every format. The geoip-log-analyzer works out of the box with standard Nginx Combined logs, according to its README. However, custom Apache or JSON logs may require changing the ip = line_parts[0] extraction line so the script reads the correct field.
How much log data should you analyze?
According to Rheinwunder, seven to fourteen days of log data is usually sufficient for analysis. That window typically reveals coverage, frequency and error patterns for AI crawlers. However, shorter windows may miss recurring crawl cycles. Start within that range so the patterns you find are representative.
Why use logs instead of analytics for AI crawler traffic?
Analytics tools rely on JavaScript, but AI crawlers often do not execute it. **Server logs record requests from clients that never run JavaScript**, so they capture crawler activity that script-based analytics miss. According to Semji's guide, Search Console does not track AI bots. That leaves server logs as the raw source of truth for this activity.
Related in this topic
- Server Log Analysis for SEO Geo TargetingLearn how server logs reveal geo-targeting gaps, crawl patterns, and AI engine visibility.
- Server Logs GEO Analysis Best PracticesLearn server logs geo analysis best practices: GeoIP mapping, AI crawler tracking by region, log retention, and geo-based security signals.
