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 reply to Re: Tailing/Streaming a Log File into Any Web Browser from Daemon by ickyb0d
in thread Tailing/Streaming a Log File into Any Web Browser from Daemon by hackdaddy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.