tags:

views:

289

answers:

1

I need to hack up a quick webpage that displays a log file in real time as contents get added to that file.

For example, it would be like a realtime 'tail -f error_log' type of command but would be constantly updated on the webpage.

Has anyone seen/heard/dreamt of a Ruby/Jquery solution already out there? (Plugin, gem, etc.)?

Thanks, Chad

+1  A: 

Well, it is impossible to show things exactly live, unless you have complete control over the thing writing to the log.

Something could automatically refresh the contents every 10-20 seconds.

On the first request, everything would be show. Then the AJAX requests would send the last line the client has then Ruby would have to open the file, find that line and send everything after that back.

This would be hard on the server with anything more than 1 or 2 clients. The real difficulty is that the server cannot 'push' changes to the client, the client can only check in and see if their are changes.

I know 0 Ruby, so I can't write anything for you, but that is how it would go.

Ramblingwood
Thanks Ramblingwood. This makes sense. I'm leaning towards using a Ruby or Python UDP syslog listener to send messages out to a service or API that could queue them up...
Chad
That sounds good. But what do you mean by queue them up? Queue them up so that they can do what?
Ramblingwood