Is my implementation of "tail -f" neat enough? I think so.

I don't know if sleep/poll cycles are the most efficient way of doing things here. You might want to try using select if you can.

... is the reopening of the current logfile done properly assuring no loss of data

I'm not sure.. imagine this scenario:

  1. Your process scans the logs.
  2. Your process sleeps.
  3. While you are sleeping, the server outputs the bad error lines.
  4. Still while you are sleeping, the logs get rotated.
  5. When you wake up, you'll start processing the new file and never see the error lines.


In reply to Re^3: File tracking by ehdonhon
in thread File tracking by r

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.