NAME

ADMLogHandler.pm


USAGE

use ADMLogHandler;


DESCRIPTION

ADMLogger is an object-oriented extendable framework for log analysis tools. Many system administrators have a handful of tools that they like to run on their logs daily/weekly/at rotation, etc. ADMLogger attempts to bring them all together by providing a set of common tools for all perl scripts to to maintain a consistency across all programs. It also allows the admin to only run a single program, and for them to focus on the coding of the core of what they need to do - allowing ADMLogger to provide all I/O support, etc.

Typical lifecycle of an ADMLogHandler object: Contruction Registration(s) Execution Retrieval (Destruction)


BUGS

None known.


AUTHORS

Aaron D. Marasco (Aaron@Marascos.net)


LIST OF PUBLIC METHODS

 new
 register
 execute
 retrieve
 retrieve_condensed


METHODS

new
Constructor

Usage:

 new(\$pre_func, \$post_func, $log_name, $new_name);

Parameters:

 \$pre_func  - pre-processing function to execute
 \$post_func - post-processing function to execute
 $log_name   - the name of the log file
 $new_name   - the name of the processed log file

Returns:

 Reference to ADMLogHandler ready to have registrations.

register
Usage:
 register(\$regex_array, $plugin);

Parameters:

 \$regex_array - reference to an array of regular expressions
 $plugin       - name of the plugin requesting these matches

Returns:

 String - Empty if success, else error message.

execute
Usage:
 execute();

Parameters:

 none

Returns:

 String - Empty if success, else error message.

retrieve
Usage:
 retrieve($plugin);

Parameters:

 $plugin - name of the plugin requesting these matches

Returns:

 A scalar containing everything you asked for

retrieve_condensed
Usage:
 retrieve_condensed($plugin);

Parameters:

 $plugin - name of the plugin requesting these matches

Returns:

 A reference to an array of arrays. Every element of the upper array
 is an array where [0] is the number of lines seen that day, [1] is the
 date from the condensing, and [2] is the actual line.

Example: Mar 30 23:03:44 hostname ftp-child[3978]: USER-WRN 'NOOP' without login from nn.nn.nn.nn Mar 30 23:03:44 hostname ftp-child[3978]: USER-WRN 'NOOP' without login from nn.nn.nn.nn Mar 30 23:04:22 hostname last message repeated 4 times

 The result would be the following (from Data::Dumper):
  $VAR1 = [
            [
              6,
              'Mar 30',
              'hostname ftp-child[3978]: USER-WRN \'NOOP\' without login from nn.nn.nn.nn'
            ]
          ];