The following program returns strange results. It will tail along fine. But then suddenly it will read multiple lines from one of the sources files. Lines that are fairly old. Code below, and sample output even lower( notice the time-date stamps)
---Source --- #!/usr/bin/perl -w use strict; use File::Tail; $|=1; my @ports = (10290,10291,10292,10293,10294,10295,10298); my @logs; foreach my $port (@ports) { my $file = "/usr/local/qpxlocal/log/act*" . $port . ".log"; my @files = `/bin/ls -r $file`; if($files[0] ne "") { chomp $files[0]; push(@logs,$files[0]); print "Push $files[0]\n"; }else{ print "Log file for $port is missing!\n"; } } my @files_to_tail; my $debug; foreach (@logs) { push(@files_to_tail,File::Tail->new(name=>"$_",debug=>"1",maxinter +val=>"1",i nterval=>"1", errmode=>"warn",reset_tail=>"-1")); } while(1) { my ($nfound,$timeleft,@pending)=File::Tail::select(undef,undef,und +ef,2,@file s_to_tail); unless($nfound) { my @ints; foreach(@files_to_tail) { push(@ints,$_->interval); } print "Nothing new in the past 1 seconds (" . join(",",@ints) +. ")\n"; } foreach (@pending) { my $file_name = $_->{'input'}; my $read_data = $_->read; $file_name =~ /.+(\d{5})\.log/; my $port = $1; print "$port: $read_data";# unless $_->predict; } }
---End Source---

--Begin output---

>perl big_log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10290.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10291.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10292.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10293.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10294.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10295.log Push /usr/local/qpxlocal/log/activity-200104192022-av2J15-10298.log Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) 10290: [20010419 20:22z] AVS started on port 10290 of av2J15.eg.orbitz +.com [av2J15:10290] 10291: [20010419 20:22z] AVS started on port 10291 of av2J15.eg.orbitz +.com [av2J15:10291] 10298: [20010419 20:23z] ERROR: zero-length command received, or timeo +ut (ignored) 10298: [20010419 20:23z] an error occurred processing the last command +: return code -1. 10298: [20010419 20:25z] [987711918182] Flight V0 Cache count= 941 tim +eout= 1000 local= 0 remote= 941 returned= 522 elapsed= 106.61 Nothing new in the past 1 seconds (1,1,1,1,1,1,1) 10290: [20010419 20:27z] [987712053494] Flight V0 Cache count= 712 tim +eout= 1000 local= 0 remote= 712 returned= 336 elapsed= 95.03 Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) 10290: [20010419 20:27z] [987712057676] Flight V0 Cache count= 712 tim +eout= 1000 local= 0 remote= 712 returned= 264 elapsed= 118.06 Nothing new in the past 1 seconds (1,1,1,1,1,1,1) 10290: [20010419 20:27z] [987712061014] Flight V0 Cache count= 712 tim +eout= 1000 local= 0 remote= 712 returned= 376 elapsed= 92.58 Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1) Nothing new in the past 1 seconds (1,1,1,1,1,1,1)

In reply to File::Tail Issue by neb

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.