Robots.txt has an awkward reputation. It is often the first file a site owner edits and the one most often mistaken for a security control. It blocks nothing. It asks. A crawler that respects the rules reads the file and stays out of the paths you list; a scraper that does not care helps itself to your content and leaves the same footprints in your logs as everyone else.
That weakness is also an opportunity. Configured deliberately, robots.txt becomes a cheap monitoring instrument: a set of quiet tripwires that only misbehaving clients trip, plus a map that keeps Googlebot and Bingbot crawling the pages you actually want indexed. Here is how to build that setup without hurting search visibility.
The file sits at your domain root and contains one or more groups. Each group names a User-agent and then lists Allow and Disallow paths. That is the whole language for practical purposes.
Three properties matter for monitoring. Compliance is voluntary, so results vary by client. Crawlers cache the file, so plan on a lag of hours, sometimes a day, before a new rule takes effect. And the file is public: anyone can read your rules, including the scrapers you would rather keep guessing. None of that stops you from using robots.txt as a signal layer. It just means your server logs remain the source of truth, and robots.txt decides who shows up where.
Most robots.txt disasters come from one line: Disallow: /. It looks like a security precaution and behaves like a slow eviction from search results. Keep the file narrow instead, and follow a few habits that keep legitimate crawlers healthy:
A canary path is a URL that no human and no honest crawler should ever request. You disallow it in robots.txt, never link to it, and log every hit. Anyone knocking on that door either ignored your rules or arrived through automated mischief.
Treat a hit as evidence to investigate, not a verdict. Old bookmarks, uptime monitors and security scanners wander into strange places all the time.
The trap only works if you read what it catches. A combined-format line carries everything you need: IP address, timestamp, request line, status code, referrer and user agent. Keep at least 90 days of access logs, rotate them, and consider routing trap requests to their own log file so they are easy to pull.
For each hit, note the IP, the exact user agent string, the requested path, the status code and the time gap to the client's previous request. That last number separates a patient crawler from a script hammering your site.
Group trap hits by user agent on a standard nginx or Apache log:
awk -F'"' '/trap\// {print $6}' access.log | sort | uniq -c | sort -rn | head -20
Then see which addresses are hitting hardest:
grep "/trap/" access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20
Adjust the field numbers if your log format differs, and expect a long tail of one-off strings. Spoofed user agents are common, so verify the important ones: do a reverse DNS lookup on the IP and confirm the hostname resolves back to the same address. Googlebot and Bingbot both publish that verification pattern, and a fake string usually fails one of the two lookups.
Volume alone says little. A well-behaved crawler and an aggressive scraper can both pull thousands of pages. Look at shape instead. Legitimate crawlers fetch /robots.txt before going deeper, request a wide but sensible set of real URLs, and slow down when your server returns errors. Scanners skip robots.txt, request paths that never existed, rack up 404s, and rarely follow a link pattern you would recognize.
Watch for three patterns in particular: a high 404-to-200 ratio, hundreds of requests to unrelated path families in a short window, and requests for files like /.env or old backup archives. Those are reconnaissance, not indexing. When one user agent dominates your trap log and your error log at the same time, you have your answer.
Monitoring works better as a small habit than a big project. Once a week: open the trap log and list the top five offenders, verify any client claiming to be a major search engine, confirm that Googlebot's requests to your real content have not dropped since your last robots.txt edit, and skim your rules for anything that grew stale. Add a line to a simple changelog each time you edit the file, with the date and the reason.
That is the whole loop. You keep search engines crawling freely, you learn who ignores your rules, and you do it with a text file and the logs your server was already writing.
Photo: Pavel Danilyuk / Pexels