ImportJob(3pm)

NAME
Lire::ImportJob - Object used to represent an periodical source of log data

SYNOPSIS
  use Lire::ImportJob;

  my $src = new Lire::ImportJob( "name",
                                 'pattern'    => "/var/log/messsages",
                                 'period'     => "unique",
                                 'processor'  => $name,
                                );

  my $file = $src->file,

DESCRIPTION
The Lire::ImportJob object is used to represent a source of log data. ImportJobs can also be instantiated from configuration data (The 'import_job' configuration specification.)

new( $name, ... );
Create a new Lire::ImportJob object. As mandatory parameter, it takes the name of the log source.

Additional parameters:

pattern
    The path to the file that contains the log data. This filename can contain strftime(3) patterns that will be substituted to obtain the name of the file. (Useful for automatic rotation).

period
    The periodicity to which this ImportJob should be processed. Defaults to 'unique' which means this is a one-shot ImportJob. Other recognized values are 'hourly', 'daily', 'weekly', 'monthly' and 'yearly'.

converter
    The name of the converter that can be used to process the ImportJob. This must be known to the Lire::PluginManager.

converter_config
    Configuration parameter for the DlfConverter.

filter
    A shell command that will be used to filter the log file.

encoding
    Encoding for the log file. If omitted, the default system encoding will be used.

  name()
Returns the name of this ImportJob.

  period( [$new_period] )
With no argument, returns the period of this ImportJob. With a parameter, the ImportJob's period is set to this new value.

  file( [$time] )
Returns the file to be used. The optional $time parameter (which defaults to now) is used to compute the file name. To find the file to use for yesterday's data, one could pass time - 86400.

  pattern( [$new_file] )
Returns the file pattern to use as log data source. This pattern may contain strftime(3) substitutions. If an argument is used, it will change the file to use.

  filter( [$new_filter] )
Returns the shell command that will be used as filter. Undef or '' will not use a filter.

  encoding( [$new_encoding] )
Returns the encoding of the log file. Undef and '' means to use the system default encoding.

  converter( [$new_name] )
Returns the name of the converter that should be used for this ImportJob.

  converter_config( [$new_config] )
Returns a configuration object that should be used by the DlfConverter (through the set_configuration() method).

  log_fh( [ $time ] )
Returns a file handle that can be used to read from the log. $time is the parameter taken by file to determine the final filename. All filters and encoding will be setup properly.

  run( $store )
Runs this ImportJob and import it into the $store DlfStore.

SEE ALSO
Lire::DlfStore(3pm) Lire::DlfConverter(3pm)

AUTHOR
  Francis J. Lacoste <flacoste@logreport.org>

VERSION
$Id: ImportJob.pm,v 1.11 2004/06/29 18:37:03 flacoste Exp $

COPYRIGHT
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 or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.