|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Re: Tailing/Streaming a Log File into Any Web Browser from Daemonby ickyb0d (Monk) |
| on Nov 17, 2005 at 10:52 UTC ( [id://509444]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
well here's what i'm thinking to solve this. when the initial page is loaded, create a file called log.old containing the current contents of the log file. Then have an ajax function run on a javascript refresh (every 5,10,30 seconds or whatever). If you anticipate a lot of date being transferred (2000+ chars or so) be sure to make the ajax function a post function, rather than get. have this ajax function call a perl script that populates a new version of the log file, log.net. then run a 'diff log.old log.new' and store the result in a file/variable' then move log.new to log.old. doign this will help cut down on transferring the whole file every time. then just return the diff text from the ajax function using the returned text, simply append it to either a div or a text area on that webpage using various DOM techniques I'm fairly confident that this would work, it's just a matter of putting all the right pieces together. for all the ajax functions check out XMLHttpRequest
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||