in reply to Re^4: Tail'ing a log that frequently rolls over
in thread Tail'ing a log that frequently rolls over

The only change I made was to swap the "tail -F" with "tail -f"

-f is equivalent to --follow=descriptor, it follows the descriptor or filehandle which won't work for a rotating log file. You need -F or --follow=name for that.

If you email me, (see my homenode), I'll send you a copy of the executable. But it originated from the UnxUtils website, though it may be a couple of years old.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^6: Tail'ing a log that frequently rolls over
by frd1963 (Initiate) on Jan 14, 2009 at 16:07 UTC
    You are correct about the "-f" following the file inode, not the filename, but regardless, tail should not have hung. It should at least have outputed the last 10 lines (by default) and then hung.
    In my own scripts, I did use "--follow=name" and got the same results, and I have since tried that in your script and it made no difference.

    I am trying not to hate windows, but I know on Unix, I would have been able to trace the process (truss or strace) to find out why or at least where it is hanging.

    Anyway, I will contact you for that older version of the Tail.exe which seems not to have this bug (and supports "--follow=name" as "-F" though this is more an annoyance than a bug, but may point to the problematic inconsistencies in the newer version.)

    Thanks once again for your assistance,
    -Frd

      It should at least have outputed the last 10 lines (by default) and then hung.

      It did! But there is a (usually) 4k buffer on the pipe. If those 10 lines didn't fill that buffer, then your read would never complete. You can prove this by tailing a file with long lines, or just add -100 to the command line.

      I am trying not to hate windows, but I know on Unix, I would have been able to trace the process (truss or strace) to find out why or at least where it is hanging.

      So, get a copy of NtTrace.exe, though it does take a certain familiarity with the OS to interpret the output--just as it does with STrace.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.