Friday, July 6, 2007

Website visited statistics

For counting the visited amount, first of all, add one configuration in config/environment.rb
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", "daily")

1. get the request statistics
cat production.log.20070702|grep "200 OK"|wc -l

2. get the URL visited statistics
cat production.log.20070702 | grep "200 OK" | awk '{print $17}'|sort|uniq -c | sort -r -n > stat.log

No comments: