.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "W3CExtendedLog 3pm" .TH W3CExtendedLog 3pm 2025-09-28 "Lire 2.1.1" "LogReport's Lire Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Lire::W3CExtendedLog \- Base implementation of a W3C Extended Log parser .SH SYNOPSIS .IX Header "SYNOPSIS" use Lire::W3CExtendedLog; .PP my \f(CW$parser\fR = new Lire::W3CExtendedLog; .PP my \f(CW$w3c_rec\fR = \f(CW$parser\fR\->parse( \f(CW$line\fR ); .SH DESCRIPTION .IX Header "DESCRIPTION" This module defines objects able to parse W3C Extended Log Format. This log format is defined at http://www.w3.org/TR/WD\-logfile.html .PP All attributes of the created object can be overriden by e.g. modules extending the object. The attributes are: .SS type2regex .IX Subsection "type2regex" \&\fItype2regex\fR is a hash containing key\-value pairs like .PP .Vb 1 \& \*(Aqname\*(Aq => \*(Aq([\-_.0\-9a\-zA\-Z]+)\*(Aq .Ve .PP Keys are all data formats for log file field entries as defined in the W3C specification: \*(Aqinteger\*(Aq, \*(Aqfixed\*(Aq, \*(Aquri\*(Aq, \*(Aqdate\*(Aq, \*(Aqtime\*(Aq and \*(Aqstring\*(Aq, along with \*(Aqname\*(Aq and \*(Aqaddress\*(Aq types. .SS identifier2type .IX Subsection "identifier2type" \&\fIidentifier2type\fR is a hash containing key\-value pairs like .PP .Vb 3 \& \*(Aqdns\*(Aq => \*(Aqname\*(Aq, \& \*(Aquri\-query\*(Aq => \*(Aquri\*(Aq, \& \*(Aqip\*(Aq => .Ve .PP Keys are the W3C defined Field identifiers, with their prefixes stripped off. .SS field2re .IX Subsection "field2re" \&\fIfield2re\fR is subroutine; when called as .PP .Vb 1 \& $self\->{field2re(\*(Aqc\-ip\*(Aq)} .Ve .PP it will return e.g. .PP .Vb 1 \& \*(Aq(\ed+\e.\ed+\e.\ed+\e.\ed+|\-)\*(Aq .Ve .PP Arguments are as found in the Fields directive, so, in an ideal world, should be identifiers. It uses \fItype2regex\fR. .SS field2decoder .IX Subsection "field2decoder" \&\fIfield2decoder\fR is a subroutine; it returns one of \fI\e&uri_decode\fR , \&\fI\e&string_decode\fR or \fIundef\fR, depending on, a.o., \fIis_iis\fR. It is used by \fIbuild_parser\fR. .SS parse .IX Subsection "parse" \&\fIparse\fR is the preferred interface to this module. It expects a line as its argument, and returns a reference to a hash (like \fI&w3c_parser\fR), or executes \&\fI&parse_directive\fR. .SS parse_directive .IX Subsection "parse_directive" \&\fIparse_directive\fR expects a directive in its argument, it fills the object. .SS w3c_parser .IX Subsection "w3c_parser" \&\fIw3c_parser\fR is a subroutine; it expects a logline as argument, and returns a reference to a hash, mapping \f(CW$self\fR\->{\*(Aqfields\*(Aq} entries to their decoded values. It uses the \fI&field2re\fR and \fI&field2decoder\fR routines. It is build in build_parser. .SS build_parser .IX Subsection "build_parser" \&\fIbuild_parser\fR is a subroutine, it builds and returns \fI&w3c_parser\fR. It is called in \fI&parse_directive\fR. .SS "log_date and log_time" .IX Subsection "log_date and log_time" \&\fIlog_date\fR and \fIlog_time\fR contain strings constructed from the Date directive. .SS "version and sofware" .IX Subsection "version and sofware" \&\fIversion\fR and \fIsoftware\fR contain strings constructed from the Version and Software directives, respectively. .SS fields .IX Subsection "fields" \&\fIfields\fR contains the entire string from the Fields directive. .SS is_iis .IX Subsection "is_iis" \&\fIis_iis\fR is set in case the Software directive contains \*(AqMicrosoft Internet\*(Aq as a substring. It is used to enable IIS specific support. .SS tab_sep .IX Subsection "tab_sep" \&\fItab_sep\fR is set in case tabs are found in the Fields directive. We assume these will be used in the log itself too, and allow unescaped spaces in the log. .PP Summarizing: .PP .Vb 2 \& &parse \-\-calls\-\-> &parse_directive \& \`\-\-calls\-\-> &w3c_parser \& \& &parse_directive \-\-calls\-\-> &build_parser \& \& &build_parser \-\-calls\-\-> &field2decoder \& \`\-\-calls\-\-> &field2re \& \`\-\-returns\-\-> &w3c_parser \& \& &field2decoder \-\-returns\-\-> &uri_decode, &string_decode \& \& &field2re \-\-uses\-\-> %type2regex \& \`\-\-uses\-\-> %identifier2type .Ve .SH "BUILDING INHERITING MODULES" .IX Header "BUILDING INHERITING MODULES" FIXME . Needs to be written. Steal from w3c_extended2dlf\*(Aqs Lire::WWW::ExtendedLog, which ISA Lire::W3CExtendedLog. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBw3c_extended2dlf\fR\|(1), \fBms_isa2dlf\fR\|(1) .SH AUTHOR .IX Header "AUTHOR" .Vb 1 \& Francis J. Lacoste .Ve .SH VERSION .IX Header "VERSION" \&\f(CW$Id:\fR W3CExtendedLog.pm,v 1.18 2006/07/23 13:16:30 vanbaal Exp $ .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2001\-2002 Stichting LogReport Foundation LogReport@LogReport.org .PP This file is part of Lire. .PP Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html.