Changeset 17272
- Timestamp:
- Apr 2, 2008, 10:47:23 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/arclog/arclog.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/arclog/arclog.pl
r17271 r17272 18 18 # accept no options 19 19 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 20 21 my $filter_records = 1; 20 22 21 23 my $rcfile = "$ENV{HOME}/.arclogrc"; … … 98 100 # since the order in the sqllite db isn't guarenteed and we can't sort in the 99 101 # db, we have to do this by hand 100 my $last_recorded_time; 102 # 103 # futher, since it doesn't take 0 time to poll the cards -- and as it testing 104 # it was determined that some cards weren't properly synced to an NTP server. 105 # We should figure out the last record time for each host. 106 my %latest_times; 101 107 { 102 108 my $strptime = DateTime::Format::Strptime->new( … … 117 123 my $dt = $strptime->parse_datetime($time); 118 124 119 if ( ! defined $last_recorded_time) {120 $la st_recorded_time= $dt;121 } elsif ($dt > $la st_recorded_time) {122 $la st_recorded_time= $dt;125 if (not exists $latest_times{$host}) { 126 $latest_times{$host} = $dt; 127 } elsif ($dt > $latest_times{$host}) { 128 $latest_times{$host} = $dt; 123 129 } 124 130 125 }126 127 # warn "latest timestamp is: $last_recorded_time\n";128 129 unless (defined $last_recorded_time) {130 warn "failed to determine the time of the last recorded record\n";131 131 } 132 132 } … … 150 150 my ($host, $time, $device, $event, $elapse_time, $errors) 151 151 = @$rec{qw( host time device event elapse_time errors )}; 152 # pack record 152 153 $query->execute("$host|$time|$device|$event|$elapse_time|$errors") 153 154 or die "database error: $!"; 154 155 155 156 # do not print filtered records 156 foreach my $filter (@myfilters) { 157 next RECORDS if $event =~ /$filter/; 157 if (defined $filter_records) { 158 foreach my $filter (@myfilters) { 159 next RECORDS if $event =~ /$filter/; 160 } 158 161 } 159 162 160 if ($time > $la st_recorded_time) {163 if ($time > $latest_times{$host}) { 161 164 print "$host $time $device $event $elapse_time $errors\n"; 162 165 }
Note:
See TracChangeset
for help on using the changeset viewer.
