Apache::LogRegex

Apache::LogRegex can parse a line from an Apache logfile into a hash.
Download

Apache::LogRegex Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Peter Hickman
  • Publisher web site:
  • http://search.cpan.org/~peterhi/Apache-LogRegex-1.4/lib/Apache/LogRegex.pm

Apache::LogRegex Tags


Apache::LogRegex Description

Apache::LogRegex can parse a line from an Apache logfile into a hash. Apache::LogRegex can parse a line from an Apache logfile into a hash.SYNOPSIS use Apache::LogRegex; my $lr; eval { $lr = Apache::LogRegex->new($log_format) }; die "Unable to parse log line: $@" if ($@); my ta; while ( my $line_from_logfile = ) { eval { ta = $lr->parse($line_from_logfile); }; if (ta) { # We have data to process } else { # We could not parse this line } }Designed as a simple class to parse Apache log files. It will construct a regex that will parse the given log file format and can then parse lines from the log file line by line returning a hash of each line.The field names of the hash are derived from the log file format. Thus if the format is '%a %t "%r" %s %b %T "%{Referer}i" ...' then the keys of the hash will be %a, %t, %r, %s, %b, %T and %{Referer}i.Should these key names be unusable, as I guess they probably are, then subclass and provide an override rename_this_name() method that can rename the keys before they are added in the array of field names.Requirements:· Perl


Apache::LogRegex Related Software