What I Did On My Holiday Break
Having sufficient time to fall down the rabbit hole - and crawl out again!
Hirb is terrific!
I've been wanting to build a traffic-tracker into triopticon.com just for the heck of it. Underneath this idle wish is a faint frustration with log files. I've always used an Apache Proxy to bounce requests to and fro which causes all requests in production.log to look like they're from portsmouth, while the useful traffic data is over there in the Apache log file. I'm too lazy to get awstats organized (more about that directly, in the Systems Administration project); besides, this is more fun.
before_filter :guest_list, :only => [:index, :show]
def guest_list
@visitor = Visitor.new
@visitor.ip = request.remote_ip
@visitor.url = request.path
@visitor.save!
end
But all the entries are from portsmouth! Dang. Time for Phusion Passenger/mod_rails and boy was that ever easy! I've set this up a couple of times on Edison for development, and for some odd reason figured it would be complicateder on the server. Not so.
Loading production environment (Rails 2.3.4) >> require 'hirb' => true >> Hirb.enable => true >> Visitor.all +----+-----------------+--------+-----+--------------------------------+--------------------------------+ | id | ip | domain | url | created_at | updated_at | +----+-----------------+--------+-----+--------------------------------+--------------------------------+ | 1 | 000.000.000.204 | | / | Tue Dec 29 14:16:22 -0600 2009 | Tue Dec 29 14:16:22 -0600 2009 | | 2 | 000.000.000.204 | | / | Tue Dec 29 14:16:34 -0600 2009 | Tue Dec 29 14:16:34 -0600 2009 | | 3 | 000.000.000.204 | | / | Tue Dec 29 14:16:40 -0600 2009 | Tue Dec 29 14:16:40 -0600 2009 | | 4 | 000.000.000.204 | | / | Tue Dec 29 14:20:45 -0600 2009 | Tue Dec 29 14:20:45 -0600 2009 | | 5 | 000.000.000.205 | | / | Tue Dec 29 14:36:00 -0600 2009 | Tue Dec 29 14:36:00 -0600 2009 | | 6 | 000.000.000.205 | | / | Tue Dec 29 14:36:08 -0600 2009 | Tue Dec 29 14:36:08 -0600 2009 | +----+-----------------+--------+-----+--------------------------------+--------------------------------+ 6 rows in set >>
Note: 000.000.000.204 is portsmouth and 000.000.000.205 is the public IP of my internal network.
Comments