Poor man’s site stats

One of the strange things about the normal TextDrive plan is that they don’t provide any site statistics. Fooling around on the command line recently I came up with this:

$ cat logs/access_log | awk '{print $1}' | sort | uniq | wc -l

Which tells me the number of unique IP addresses that have hit my site in the last day. Without getting too complicated I can also get the total number of unique visitors ever (or at least as far back as my logs go).

Here’s the code:

$ (cat logs/access_log && gzip -dc logs/access_log*.gz) | awk '{ print $1 }' | sort | uniq | wc -l

And this shows me the total number of unique visitors to RadiantCMS.org.

What are you doing on TextDrive?

© 2013 John W. Long