Grep Apache access log for browser and OS version

Posted by Andrew McCombe on Thu Jun 5, 2014

Today I’ve needed to find out if it was worth testing a client’s website with Safari 5 on Windows. The site in question is very specialised and has an extremely busy period during the summer months and then is quiet for the rest of the year. To find out the number of uses my only option was to grep the Apache access log for the browser and OS version. I used the following shell fu, based on the very helpful article at enter link description here:

awk -F\" '{print $6}' access_log | sort | uniq -c | grep -i 'Safari' | grep -i 'Version/5' | grep -i "windows"|  sort -fr

This yielded the results which were pretty low, only 456 instances of Safari 5.x on Windows during a 3 month period of high traffic in the summer of 2013. As Apple has kissed goodbye to Safari on Windows I decided that it isn’t worth testing on it.