DlfConverter(3pm)
π DlfConverter(3pm) β the glow-up
ok so this is DlfConverter, straight out of LogReport's Lire Documentation, and honestly? it's giving base-class energy in the best way possible. it's the blueprint bestie, the template, the moment before the actual converter shows up β¨
πΈ NAME πΈ
Lire::DlfConverter β the base interface of all DLF converters. like, every single one. the mother of converters. the blueprint. the moment. π
π¦ SYNOPSIS π¦
use base qw/ Lire::DlfConverter /;
that's it. that's the whole vibe check. you inherit from it, that's literally the assignment π
β¨ DESCRIPTION β¨
okay so listen. this package defines the interface that every last DLF Converter has to implement. it's the group chat rules, basically β everyone who joins has to follow them.
and here's the tea: all the methods defined in this package will throw a 'method not implemented' exception if you call them. every single one. no cap. so if you try to use this bad boy directly it's gonna yell at you π it's a base class, not a plug-and-play situation.
π META INFORMATION METHODS π
these are the methods that feed info to the Lire framework about the DLF converter. the little biography section of the converter's profile, if you will π
π name()
returns the name of the DLF converter β i.e. the service's name (aka the log format name).
E.g. "combined"
π title()
returns a more human friendly name for the DLF Converter. like the display name, the one you'd put on the little name tag π«Ά
E.g. "Combined Log Format DLF Converter"
π§ description()
returns a DocBook XML based documentation of the DLF Converter. yes, XML. it's giving old school but we respect it β¨
E.g. <para>This DLF converter can be used to process log file in the Combined Log Format to the www DLF schema.</para>
π schemas()
returns a list of DLF schemas for which DLF records can be written from the data contained in the log file. like, "here's what I can output to, bestie" π
E.g. for the combined DLF converters, that would be 'www'.
for the 'nms' converter that could be "qw/daemon email/" β which means the DLF converter writes DLF records in the hypothetical "daemon" schema (server start, stops, restarts, etc.) and the email schema. multi-talented tbh.
β οΈ this should only contain 'base' (aka superservice) schemas. no extended or derived schema's name should appear in that list. those are reserved for the analyzers, periodt. don't be out here claiming schemas that aren't yours π
π handle_log_lines()
this method should return true if the DlfConverter processes line-oriented log file. that's the default, and honestly it's the most common situation.
but if it returns false? then only the process_log_file() method will be called. otherwise the process_log_line() method is used for every input line. choose your fighter π₯
πΈ Implementation methods πΈ
these are the methods where the actual DLF converter work happens. the main character methods, if you will π
here's the sequence, and it's a whole choreography:
init_dlf_converter()gets called once before any processing occurs.- afterwards,
process_log_line()gets called once for every line that was marked for log continuation, and for every line contained in the log file. finish_conversion()gets called once all lines are processed.
π¨ and heads up: any exceptions (uncaught die) that occur during any of these methods will abort the conversion process. no recovery arc. it's done. π
π«Ά init_dlf_converter( $process, [$config] )
the framework calls this before processing the log file. it's your converter's "get ready with me" moment β use it to initialize its state β¨
$processβ contains theLire::DlfConverterProcessobject which is controlling the conversion process. the manager. the one in charge π$configβ contains configuration data that was specified in theImportJobfor that converter. to register configuration specification for your DlfConverter, you just need to define aconfiguraitonspecification under the nameconverter_name_properties(yes, that's how it's spelled in the source, we don't fix, we respect π). this should be either aRecordSpecorObjectSpec.
π¦ process_log_file( $process, $fd )
this method is called so that the converter can convert the data contained in the $fd file handle to DLF. this one is only used when the handle_log_lines() method returned false β so like, the non-line-oriented path π£οΈ
$process contains a reference to the Lire::DlfConverterProcess object which controls the conversion process and defines the API to write DLF and report errors. it's your whole toolbox fr fr.
β process_log_line( $process, $line )
the framework calls this once for each log line present in the log file. and it's only called if the handles_log_lines() method returnes true π
$processβ a reference to theLire::DlfConverterProcessobject. this object defines a method to report errors, save lines for continuation purposes, and writes DLF records. the whole toolkit, iconically.$lineβ contains the log line which should be processed, with the end of line removed. no trailing newline shenanigans, it's already handled π
π finish_conversion( $dlf_store )
called once by the framework, once all log lines were processed. the closing ceremony π it can be used by the converter to write any DLF records that could be remaining because of a stateful analysis. you know, the stragglers. the leftover lore. write them out before you leave π
π₯ SEE ALSO π₯
the whole friend group honestly:
π AUTHOR π
Francis J. Lacoste <flacoste@logreport.org> β the icon who wrote this. we stan π«Ά
π VERSION π
$Id: DlfConverter.pm,v 1.12 2006/07/23 13:16:28 vanbaal Exp $
π COPYRIGHT π
Copyright (C) 2002, 2003, 2004 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. no promises bestie, it's a licence thing π
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 page!! π β¨ and for the little sign-off credits: this gorgeous piece of documentation is from Lire 2.1.1, and it was last touched on 2025-09-28. slay, date-stamped, immortalised ππ¦
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms