ApacheLog-Parser

 view release on metacpan or  search on metacpan

bin/loghack  view on Meta::CPAN

  }

  if($o{daemon}) {
    daemon(\%o, @args);
    exit;
  }

  my %modes = map({$_ => 1} qw(
    makelinks
    import
    prep check sweep verify confirm list
    unique day_unique month_unique month_unique2
    compile
    aggregate report date dump tabulate count reskip
  ));
  my $mode = shift(@args);
  $modes{$mode} or die "USAGE: mode must be one of ",
    join(", ", sort(keys(%modes))), "\n";

  # TODO deal with the do_ stuff
  if($o{cluster}) {

bin/loghack  view on Meta::CPAN

    print $ch "$linecount\n";
    close($ch) or die "write '$checkfile' failed $!";
    # TODO race checks/chmod

  }
  wait(); # XXX need this?
  return(@loaded);
}

=for doc ###############################################################
Examine the */.loaded files and verify that each one has a linecount
(finished loading.)
  loghack check */.loaded/*

=cut

sub do_check {
  my ($opt, @files) = @_;

  foreach my $file (@files) {
    my $err = run_check($file) or next;

bin/loghack  view on Meta::CPAN

    if($date eq 'thru') {
      push(@dates, date(pop(@dates))->thru(date(shift(@in))));
      next;
    }
    push(@dates, $date);
  }
  return(@dates);
}

=for doc ###############################################################
Given a date range, verify that all files + hours for that server are
done (with the exception of those listed in the .MIA file.)

=cut

sub do_verify {
  my ($opt, @in) = @_;

  my @dates = _date_dwim(@in) or die "you gave no dates";
  foreach my $dir (glob('*')) {
    (-d $dir) or next;
    foreach my $date (@dates) {
      my @got = glob("$dir/$date*");
      print "$dir/$date ", scalar(@got), "\n";
    }
  }

lib/ApacheLog/Parser/SkipList.pm  view on Meta::CPAN

########################################################################
sub _open_read {
  my $self = shift;
  my ($filename) = @_;
  my $conf_check = $self->{config} or
    croak("cannot make a reader without a config");

  open(my $fh, '<', $filename) or
    croak("cannot open '$filename' for reading $!");

  my $verify;
  my $ok = read($fh, $verify, 32);
  (($ok||0) == 32) or
    croak("read error on $filename ", (defined($ok) ? 'eof' : $!));
  ($verify eq $conf_check) or
    croak("the config has changed since this skiplist was created\n",
      "  '$verify' vs '$conf_check'");

  return($fh);
}

{
  package ApacheLog::Parser::SkipList::Base;
  sub new {
    my $package = shift;
    my ($fh) = @_;
    my $class = ref($package) || $package;



( run in 0.605 second using v1.01-cache-2.11-cpan-73692580452 )