LIRE::DLFCONVERTERPROCESS(3pm)

πŸ“¦ version 2.1.1, in arch rolling

πŸ’… NAME

Lire::DlfConverterProcess β€” the object that runs the whole DLF conversion process, like the backstage manager of your log-import era πŸ‘‘


✨ SYNOPSIS ✨

use Lire::ImportJob;
use Lire::DlfStore;
use Lire::DlfConverterProcess;

my $src = new Lire::ImportJob( "file", 'pattern' => "/var/log/messages" );
my $store = new Lire::DlfStore->open( "store" );

my $process = new Lire::DlfConverterProcess( $src, $store );

$process->run_import_job();

print "Log lines read: ",      $process->line_count(), "\n";
print "DLF records created: ", $process->dlf_count,    "\n";
print "Errors encountered: ",  $process->errors_count, "\n";
print "Ignored records: ",     $process->ignored_count,"\n";

That's the whole vibe, bestie β€” roughly eight lines and you've read a whole log file into DLF ✨


🌸 DESCRIPTION 🌸

Okay so picture this: this object encapsulates the entire Lire DLF conversion process. It takes a Lire::ImportJob and a Lire::DlfStore as its parameters, sets up the converter, and then converts the content of the Lire::ImportJob to DLF β€” which then gets saved into the Lire::DlfStore. It's giving ✨glow-up pipeline✨.

The object also hands your converter the API it needs, plus a bunch of methods for querying info about how the conversion went. Literally the whole package πŸŽ€

πŸ’œ new( $job, $store );

Creates a Lire::DlfConverterProcess that you'll use to import the log specified in Lire::ImportJob into DLF records, which get stored into Lire::DlfStore. Main character constructor energy fr fr 🫢

πŸ’œ run_import_job( [$time] )

This is the one that actually does the thing β€” it imports the log data from ImportJob as DLF.

⚠️ Heads up bestie: this method will throw an exception if you call it more than once. One and done, periodt.

The $time parameter is used to determine the time window covered by period. It defaults to the current time β€” so if you don't say anything, it just assumes now πŸ•

πŸ’œ job_id()

Returns the job identifier associated to this process. Your little name badge πŸŽ€

πŸ’œ dlf_store()

Returns the Lire::DlfStore where this conversion process is storing the DLF records. That's the home address 🏠

πŸ’œ import_job()

Returns the Lire::ImportJob that this conversion process is operating on. The source material, iykyk πŸ“–

πŸ’œ line_count()

Returns the number of lines processed.

🫢 Real talk: this will be 0 in the case where the DLF converter processes a file and not log lines. And during processing, this always equals the line that is currently being converted. Live tracking, no cap.

πŸ’œ dlf_count()

Returns the number of DLF records created. Slay-count πŸ“ˆ

πŸ’œ error_count()

Returns the number of errors encountered in the conversion process. Hopefully 0, but like… log files πŸ™ˆ

πŸ’œ ignored_count()

Returns the number of records which were ignored in the conversion process. They're not mad, they just didn't make the cut πŸ’…

πŸ’œ saved_count()

Returns the number of lines which were saved for later processing. Saving them for their own little comeback arc 🌈


πŸ‘‘ API FOR THE DLF CONVERTERS πŸ‘‘

This is the object that encapsulates the Dlf implementation and hides all the complexity of the storage framework from the DLF converter. It offers these methods to the DLF converter:

πŸ¦‹ write_dlf( $schema, $dlf )

Writes the $dlf DLF record, conforming to the $schema's schema, into the Lire::DlfStore. The schema is the schema's name (e.g. 'www'). $dlf is a hash reference β€” the keys are the schema's field names. An undefined value means that this field isn't available in that record. Ghosted fields, basically πŸ‘»

πŸ¦‹ save_log_line( $line )

The method you should use to save $line for a future processing run of the converter on the same Lire::ImportJob. Not goodbye, just see-you-later πŸ₯²

πŸ¦‹ ignored_log_line( $line, [ $reason ] )

The method a Lire::DlfConverter can use to report that the '$line' log line was ignored during that processing. You can pass in why it got ignored via $reason.

πŸ“ For example: syslog-based converters should use this method to report lines that belong to a different 'service' than theirs. Not their circus, not their monkeys πŸŽͺ

πŸ¦‹ error( $error_msg, [ $line ] );

The method a Lire::DlfConveter should use to report that an error was encountered while processing the Lire::ImportJob. Use $error_msg to report the nature of the error. And the $line parameter should be used by converters operating on lines, to associate the error message with one particular line. Receipts, basically 🧾


πŸ”₯ SEE ALSO

Lire::DlfStore(3pm) Β· Lire::DlfConverter(3pm)

Go read those next, bestie, they're the supporting cast 🫢


πŸ’– AUTHOR

Francis J. Lacoste <flacoste@logreport.org>


⭐ VERSION

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


Copyright (C) 2002-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.

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, bestie β€” written for Lire 2.1.1, dated 2025-09-28, on the DlfConverterProcess(3pm) manual page. Go convert some logs, you absolute icon πŸ’…βœ¨

πŸ“¦ where this page comes from