↑ ↓ select, Enter open, Esc close

Find the most common user agents and bots in the access log

Adjust the values, the command updates live
root@server
awk -F'"' '{print $6}' /var/www/vhosts/system/example.com/logs/access_ssl_log | sort | uniq -c | sort -rn | head -20

Splits each log line at the double quotes and prints the sixth field, which is the user agent in the combined format. The list shows immediately whether crawlers like AhrefsBot, SemrushBot or GPTBot account for a large share of the traffic. From there you can add targeted blocks in robots.txt or in the web server.

Also searched as

  • which bots are crawling my site
  • count user agents in access log
  • find aggressive crawlers
  • which bot is causing load

Related one-liners

All in Logs

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.