Perl: the Markov chain saw | |
PerlMonks |
Tailing/Streaming a Log File into Any Web Browser from Daemonby hackdaddy (Hermit) |
on Nov 17, 2005 at 06:56 UTC ( [id://509314]=perlquestion: print w/replies, xml ) | Need Help?? |
hackdaddy has asked for the wisdom of the Perl Monks concerning the following question:
I have a daemon that runs jobs. While the job runs, it generates a log file. I would like to stream or tail that log file to users' web browsers.
I have experimented with the following recipe, but it does not show the entire log file: POE Cookbook Tail Following Web Server Ideally, I would like to create an HTML table and send chunks of the table to the browser as "tail -f mylogfile.log |" was open. I attempted this with a small hack of the HTTP::Daemon sample code. However, with Microsoft IE the table is not shown in the browser until tail stops sending HTML data. FireFox, surprising, does exactly what is expected and creates the table on the fly, but stops at approximately 16561 lines in the table. Sending plain text seems to work, but it would be of greater utility to users to parse the log file and color code particular entries, etc, using HTML. I've solved this particular problem before by sending chunks of JavaScript to the browser to append text in a textbox. I suppose I could do the same thing with AppendChild in DOM, but I dislike that solution. There is also the refresh option, but that is an expensive operation if your log file will be tens of thousands of lines long. Tailing a file through a browser is a great utility. There has to be an easier way to to this. I want to be able to accomplish this in any popular browser. Any assistance or suggestions is greatly appreciated. Thanks. P.S. As an after thought, is there any way to do this with AJAX?
Back to
Seekers of Perl Wisdom
|
|