How to get list of User-Agent from access log

I wanted to block bots from accessing a website. For this, I need to generate a list of all browser User-Agent visiting the website, so I can see which ones can block. This work with most web servers like Apache, Nginx, IIS, etc.

To get the list of all User-Agents, run

To get the List of all user agents with the number of visits, run

If you want to show the most visited User-Agents first, use “sort -nr” for reverse sorting.

See Access Log

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *