Log::Parallel::ApacheCLF - parse apache common log format
use Log::Parallel::ApacheCLF; my $parser = Log::Parallel::ApacheCLF->return_parser($fh, %info);
sources: - name: raw apache server logs hosts: host1.domain path: /var/apache_archive/%YYYY%.%MM%.%DD%{,.bz2} format: ApacheCLF valid_from: 2009-01-01 valid_to: yesterday jobs: - name: server logs destination: server logs source: raw apache server logs path: '%DATADIR%/%YYYY%/%MM%/%DD%/%JOBNAME%.%DURATION%.%BUCKET%.%SOURCE_BKT%' valid_from: 2008-01-01 valid_to: yesterday frequency: daily output_format: TSV use: Log::Parallel::TSV Log::Parallel::ApacheCLF buckets: 20 hosts: host10,host11,host12,host13 bucketizer: $log->{server_time}
Parse the apache web server logs in Common Log Format. The fields from the apache logs are named as follows:
The IP address header field. Sometimes -.
-
The HTTP authenticated user.
The time, unix time seconds, that the server wrote the log line.
The HTTP request line. Eg: GET / HTTP/1.0.
GET / HTTP/1.0
The HTTP status code. 200, 301, etc.
The number bytes transfered.
The HTTP UserAgent.
The HTTP Refferrer field.
This module can also be used to parse more extended Apache logs. Create a new module and invoke this one to do a bunch of the work. There are three extra construction arguments that can be used:
A regular expression to match of things that come before the regular Apache log format on each line. If this has saved matches, they'll be returned as an array: pre_match.
pre_match
If you have a pre_rx, and if that regular expression has saved matches, you must say how many for Log::Parallel::ApacheCLF to work. This is how.
pre_rx
A regular expression to match of things that come after the regular Apache log format on each line.
If this has saved matches, they'll be returned as an array: post_match.
post_match
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.
To install Log::Parallel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Parallel
CPAN shell
perl -MCPAN -e shell install Log::Parallel
For more information on module installation, please visit the detailed CPAN module installation guide.