samix has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks of Perl Knowledge

I am facing a wierd issue with File::Tail, the cpan doc for this module says that It automatically detects and follows the file that are rotated, but I do not see that to be the case. Below is the snippet from my code
use File::Tail; $file=File::Tail->new("/var/log/maillog"); while (defined($line=$file->read)) { print "$line"; }

After the file is rotated , I find that File::Tail stops reading the new rotated file.

Also it does not end which means that the loop is still active

I have to then kill and restart the script for it to again start reading the new rotated file

Could someone please point out where I may be faltering ?

Thanks in Advance

samix

Replies are listed 'Best First'.
Re: File::Tail not following rotated files
by almut (Canon) on Jun 01, 2010 at 11:32 UTC

    How long did you wait?  As I read the docs, File::Tail will wait for 10 minutes after the old file last changed, before trying to reopen a new file.  Did you try changing that interval with resetafter?

      My files got rotated at 4:00 hrs and I checked the script at around 11:00hrs ie more than 7 hours.

      I'll try changing the interval to see if that helps