/usr/share/perl5/Lire/DlfConverter.pm is in lire 2:2.1.1-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | package Lire::DlfConverter;
use strict;
use base qw/Lire::Plugin/;
use Carp;
=pod
=head1 NAME
Lire::DlfConverter - Base interface of all DLF converters.
=head1 SYNOPSIS
use base qw/ Lire::DlfConverter /;
=head1 DESCRIPTION
This package defines the interface that must be implemented by all
DLF Converters. All the methods defined in this package will throw a
'method not implemented' exception if they are called.
=head1 META INFORMATION METHODS
These methods provides information to the Lire framework about the DLF
converter.
=head2 name()
Returns the name of the DLF converter, i.e. the service's (aka log
format) name.
E.g. C<combined>
=cut
sub name {
croak "name() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 title()
Returns a more human friendly name for the DLF Converter.
E.g. C<Combined Log Format DLF Converter>
=cut
sub title {
croak "title() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 description()
Returns a DocBook XML based documentation of the DLF Converter.
E.g. <para>This DLF converter can be used to process log file in the
Combined Log Format to the www DLF schema.</para>
=cut
sub description {
croak "description() not implemented by ", ref $_[0] || $_[0];
}
sub type { return 'dlf_converter' }
=pod
=head2 schemas()
Returns a list of DLF schemas for which DLF records can be written
from the data contained in the log file.
E.g. For the combined DLF converters, that would be 'www'.
For the 'nms' converter that could be C<qw/daemon email/> which means
that the DLF converter writes DLF records in the hypothetical C<daemon>
schema (server start, stops, restarts, etc.) and the email schema.
This should only contains 'base' (aka superservice) schemas. No
extended or derived schema's name should appear in that list. (Those
are reserved for the analyzers).
=cut
sub schemas {
croak "schemas() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 handle_log_lines()
This method should returns true if the DlfConverter processes
line-oriented log file. This is the default. If this method returns
false, only the process_log_file() method will be called, otherwise
the process_log_line() method is used for every input lines.
=cut
sub handle_log_lines { 1 }
=head1 Implementation methods
These are the methods where the DLF converter work is done. The
init_dlf_converter() method will be called once before any processing
occurs. Afterwards, process_log_line() will be called once for every line
that was marked for log continuation and for every line contained in
the log file. The finish_conversion() method will be called once all
lines are processed. Any exceptions (uncaught die) that occur during
any of the methods will abort the conversion process.
=head2 init_dlf_converter( $process, [$config] )
This method will be called by the framework before processing the log
file. This method should be used by the converter to initialize its
state.
The $process parameter contains the Lire::DlfConverterProcess object
which is controlling the conversion process.
The $config parameter contains configuration data that was specified
in the ImportJob for that converter. To register configuration
specification for you DlfConverter, you just need to define a
configuraiton specification under the name
I<converter_name>_properties. This should be either a RecordSpec or
ObjectSpec.
=cut
sub init_dlf_converter {
croak "init_dlf_converter() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 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 method is only used when
the handle_log_lines() method returned false.
$process contains a reference to the Lire::DlfConverterProcess object
which controls the conversion process and defines the API to write DLF
and report errors.
=cut
sub process_log_file {
croak "process_log_file() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 process_log_line( $process, $line )
This method is called by the framework once for each log line present
in the log file. This method is only called if the handles_log_lines()
method returnes true.
$process is a reference to the Lire::DlfConverterProcess object. This
object defines a method to report errors, save lines for continuation
purposes and writes DLF records.
$line contains the log line which should be processed with the end of
line removed.
=cut
sub process_log_line {
croak "process_log_line() not implemented by ", ref $_[0] || $_[0];
}
=pod
=head2 finish_conversion( $dlf_store )
This method is called once by the framework once all log lines were
processed. It can be use by the converter to write any DLF records
that could be remaining because of a stateful analysis.
=cut
sub finish_conversion {
croak "finish_conversion() not implemented by ", ref $_[0] || $_[0];
}
# keep perl happy
1;
__END__
=pod
=head1 SEE ALSO
Lire::DlfConverterProcess(3pm), Lire::DlfStore(3pm), Lire::ImportJob(3pm),
Lire::PluginManager(3pm)
=head1 AUTHOR
Francis J. Lacoste <flacoste@logreport.org>
=head1 VERSION
$Id: DlfConverter.pm,v 1.12 2006/07/23 13:16:28 vanbaal Exp $
=head1 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.
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.
=cut
|