Using Rails as a Log Server - question

Hey guys, I'm just starting out with Rails, and I'm trying to build a
tool that acts as a server for collecting log output across many
machines. I was wondering if anyone could point me in the right
direction of how to continuously post text to a rails page.

For example, I have a few machines that continuously run cron jobs and
other scripts. Each machine is identifiable by its mac address. So I
was thinking they could keep sending POST requests of the form
server:3000/machines?macaddr=0.0.0.0&message="logoutput"

Is there a more sensible way to do this? Could anyone point me to some
docs on how I can implement this functionality? I have the basic
structure with scaffolding, but I'm not exactly sure how I can keep
appending text to a given page. Thanks

There's a PeriodicalUpdater control in Prototype.js that can run an Ajax request from your page to your server and update a portion of the page with any changes. Think about how Campfire works -- watching what the other people are typing is about what you're describing here.

But it doesn't work from the direction I think you're intending. Your cron jobs could indeed send their POST requests to your server, but there, a daemon would have to listen for them, save them to a database, and then your observer screen would query that database, sending in its request the last-received row id, and ask "Anything new after id 12345?" If so, the server would need to send back just the new stuff and PeriodicalUpdater would insert that on your screen.

Have a look around for a Campfire clone write-up (should be plenty of these, I've built one for learning purposes, but never released it anywhere).

Walter

Thanks! I think I'll take the route you suggested - saving POST
requests to a db and generating a page of them - without a
PeriodicalUpdater at first, because the realtime aspect of viewing logs
is not hi-priority to start. But a PeriodicalUpdater does look apt.