Extract a list of the top user agents from an Apache format log file and sort in descending order by number of occurrences:
|
awk -F\" '{print $6}' access_log | sort | uniq -c | sort -r -n | head -20 |
Results similar to this:
|
94786 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 68390 Amazon CloudFront 36131 Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0 19725 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 11865 Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36 11428 Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html) 10056 Mozilla/5.0 (compatible; AhrefsBot/7.0; +http://ahrefs.com/robot/) 6311 Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) .... |