| [reply] |
Hi,
yup, looked at File::Tail, didn't think it could work with rolling logs, unless I read the spec wrong.
Anyway, no matter I think I found a way to check this using the inode of the file and the File::Stat module, added these lines to the main loop:
if ( stat($file)->ino != $inode ) { # file has rolled if true
close (FILE);
open (FILE, "$file") or die "Cannot open file $file: $
+!\n";
$inode = stat(*FILE)->ino;
}
Obviously set $inode before entering the loop. Does seem to do the trick, but I need to do some more testing
Thanks
Jon
| [reply] [d/l] |
Hi, yup, looked at File::Tail, didn't think it could work with rolling logs, unless I read the spec wrong.
Did you miss this part?
If the file does not get altered for a while, "File::Tail"
gets suspicious and startschecking if the file was trun-
cated, or moved and recreated. If anything like that had
happened, "File::Tail" will quietly reopen the file, and
continue reading. The only way to affect what happens on
reopen is by setting the reset_tail parameter (see below).
The effect of this is that the scripts need not be aware
when the logfiles were rotated, they will just quietly
work on.
| [reply] [d/l] |
How do you know about all these "fairly obscure" modules? I've never seen File::Tail before - it's very nice! | [reply] |
| [reply] |