I wouldn't copy files around... that'd take up far to much space and time, if the log files are big — log files usually are.

A second problem is in file caching: the webserver might refuse to serve up the new file, even after it has been updated, if it delivered the "same" document somewhat earlier. A server like Apache acts as if it has a in-memory file cache. I think it must have.

A simple, fine working solution for the latter is to serve up the logs dynamically, using a script, even if all it does is just read the contents of a file and pass them along to the browser.

So... If we're already using a script to show the logs... Why not filter the existing logs while displaying them? I'm thinking of a way to timestamp the actions, and simply skipping the actions in the log that are too recent. For example, Apache's server logs include a timestamp per line.

Under the assumption that the log gets appended to, as is commonly the case, and there is no such thing as a timestamp in the data, you can save the current time and log file length whenever an event occurs, in a separate index file. That way, you can figure out where to stop reading the log, based on what tell tells you. Anything beyond that threshold is more recent.


In reply to Re: File playback with lag by bart
in thread File playback with lag by ecuguru

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.