I must publicly confess my love with the Force.com Streaming API. (Don't tell my wife.) Last September I wrote a blog post entitled, Node.js Demo with Force.com Streaming API & Socket.io that showed how to stream events from Saleforce.com to the browser using Node.js. It was a pretty cool app if you are familiar with Node.js.
Then at Dreamforce '12 I did an Un-Conference session called, "Log Force.com Events in REALTIME with Papertrail" which was a knock-off but showed how to create an external logger for Salesforce using the Force.com Streaming API. Pretty slick stuff but again in Node.js.
Well I've found a much easier way to use the Force.com Streaming API than my previous attempts thanks to the Restforce ruby gem. According to the docs "... the Restforce gem makes implementing pub/sub with Salesforce a trivial task". A bold statement but entirely true.
So I put together a sample rails app that you can use as a starter with the Force.com Streaming API. Just fork this repo, watch the video below and then follow the simple, step-by-step instructions on the repo to get started. The demo app streaming events from a "Log__c" custom object to the rails app with in turn uses Papertrail as a logger.
Here's the file that does the heavy lifting for you. It connects to your org with the Restforce client, starts listening for events on the "LogEntries" channel and then once it receives it, outputs it to Papertrail through "puts".