Well, Google Analytics is actually free, so I guess that title doesn’t make much sense. I have reused this code so many times I thought I’d share a small Bash snippet for quickly getting unique visitors when poking around your webserver. Run inside the Apache logs folder, should work for most versions of Apache too. (I felt the need for a micro post after those last two monster posts). You can add stuff after the GET to get more specific.
cat access_log* | grep "GET" | cut -d" " -f1 | uniq | wc -l
Or we can also quickly see who is looking at the most stuff. Note this is absolute resource requests, not page views.
cat access_log* | grep "GET" | cut -d" " -f1 | uniq -c | sort -n | tail