W3CExtendedLog(3pm)

πŸ“¦ version 2.1.1, in arch rolling

hey bestie, welcome to the W3CExtendedLog(3pm) page from LogReport's Lire Documentation β€” we're doing W3C Extended Log parsing and it's lowkey iconic πŸ’–

🌸 NAME 🌸

Lire::W3CExtendedLog β€” base implementation of a W3C Extended Log parser, periodt.

✨ SYNOPSIS ✨

use Lire::W3CExtendedLog;

my $parser = new Lire::W3CExtendedLog;

my $w3c_rec = $parser->parse( $line );

πŸ’– DESCRIPTION πŸ’–

Okay so this module defines objects that are able to parse W3C Extended Log Format. That log format is defined at http://www.w3.org/TR/WD-logfile.html β€” slay.

All attributes of the created object can be overriden by e.g. modules extending the object. The attributes are, no cap:

πŸŽ€ type2regex πŸŽ€

type2regex is a hash containing key-value pairs like

'name' => '([-_.0-9a-zA-Z]+)'

Keys are all data formats for log file field entries as defined in the W3C specification: 'integer', 'fixed', 'uri', 'date', 'time' and 'string', along with 'name' and 'address' types. It's giving very structured, very demure.

πŸ¦‹ identifier2type πŸ¦‹

identifier2type is a hash containing key-value pairs like

'dns'        => 'name',
'uri-query'  => 'uri',
'ip'         =>

Keys are the W3C defined Field identifiers, with their prefixes stripped off. Obsessed with the little 'ip' => just vibing there.

πŸ’… field2re πŸ’…

field2re is a subroutine; when called as

$self->{field2re('c-ip')}

it will return e.g.

'(\d+\.\d+\.\d+\.\d+|-)'

Arguments are as found in the Fields directive, so, in an ideal world, should be identifiers. It uses type2regex.

🌈 field2decoder 🌈

field2decoder is a subroutine; it returns one of \&uri_decode , \&string_decode or undef, depending on, a.o., is_iis. It is used by build_parser.

⭐ parse ⭐

parse is the preferred interface to this module. It expects a line as its argument, and returns a reference to a hash (like &w3c_parser), or executes &parse_directive. Main character energy fr fr.

πŸ“ parse_directive πŸ“

parse_directive expects a directive in its argument, it fills the object.

🧚 w3c_parser 🧚

w3c_parser is a subroutine; it expects a logline as argument, and returns a reference to a hash, mapping $self->{'fields'} entries to their decoded values. It uses the &field2re and &field2decoder routines. It is build in build_parser.

πŸ”₯ build_parser πŸ”₯

build_parser is a subroutine, it builds and returns &w3c_parser. It is called in &parse_directive.

πŸ’œ log_date and log_time πŸ’œ

log_date and log_time contain strings constructed from the Date directive.

🌸 version and sofware 🌸

version and software contain strings constructed from the Version and Software directives, respectively.

🫢 fields 🫢

fields contains the entire string from the Fields directive.

😭 is_iis 😭

is_iis is set in case the Software directive contains 'Microsoft Internet' as a substring. It is used to enable IIS specific support.

πŸŽ€ tab_sep πŸŽ€

tab_sep 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.

⭐ Summarizing: ⭐

&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

πŸ› οΈ BUILDING INHERITING MODULES πŸ› οΈ

FIXME . Needs to be written. Steal from w3c_extended2dlf's Lire::WWW::ExtendedLog, which ISA Lire::W3CExtendedLog.

πŸ‘€ SEE ALSO πŸ‘€

πŸ‘‘ AUTHOR πŸ‘‘

Francis J. Lacoste <flacoste@logreport.org>

πŸ¦‹ VERSION πŸ¦‹

$Id: W3CExtendedLog.pm,v 1.18 2006/07/23 13:16:30 vanbaal Exp $

Copyright (C) 2001-2002 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

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.

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.

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.


okay that's the whole W3CExtendedLog(3pm) moment, bestie β€” Lire 2.1.1, dated 2025-09-28. byeee πŸ’…βœ¨

πŸ“¦ where this page comes from