VBTK::Log - Monitoring of sequential ASCII text logs


VBTK documentation  | view source Contained in the VBTK distribution.

Index


NAME

Top

VBTK::Log - Monitoring of sequential ASCII text logs

SYNOPSIS

Top

  # Monitor /var/adm/messages, looking for warning or error messages.
  $obj = new VBTK::Log(
      SourceList => '/var/adm/messages');
  $obj->addVBObj(
      VBObjName => ".$::HOST.log.messages",
      Rules     => {
          '($data =~ /unix:|hardware error|panic/i)'      => 'Fail',
          '($data =~ /fail|warning|refuse/i)' => 'Warn' },
  ) if ($obj);

  &VBTK::runAll;

DESCRIPTION

Top

This perl library is a front-end to the VBTK::Wrapper class. It supports the same public methods as the VBTK::Wrapper class, but with common defaults to simplify the monitoring of a log file.

METHODS

Top

The following methods are supported

$o = new VBTK::Wrapper::Log (<parm1> => <val1>, <parm2> => <val2>, ...)

This method calls 'new VBTK::Wrapper' after defaulting the parameters to tail the specified log file. For a detailed description of the parameters, see VBTK::Wrapper. The defaults are as follows. If you like all the defaults then you don't have to pass in any parms.

Interval
    Interval => 60,

SourceList

A list of files to retrieve data from. The process will read the files in order specified. Usually, you only have one file in the list. (Required)

    SourceList => '/var/adm/messages',

VBDetail

Just dump out the rows as they are retrieved.

    VBDetail => [ '$data' ],

SkipLines
    Skiplines => '-0',

Follow

Usually you want to run in follow mode when monitoring a log file.

    Follow => 1,

FollowHeartbeat
    FollowHeartbeat => 1,

$vbObj = $o->addVBObj(<parm1> => <val1>, <parm2> => <val2>, ...)

This method calls VBTK::Parser::addVBObj after defaulting unspecified parameters to best follow a log file. For a detailed description of the addVBObj parameters, see VBTK::Parser. The defaults are as follows. If you like all the defaults then you don't have to pass in any parms

VBObjName

Name the VBObject using the local host's name.

    VBObjName => ".$::HOST.log.generic",

TextHistoryLimit
    TextHistoryLimit => 200,

ReverseText

Reverse the text, so that we see the most recently reported lines first.

    ReverseText => 1,

Rules

Watch for words like 'error', 'fail', or 'warn'

    Rules => {
      '($data =~ /error|fail/i)' => 'Fail',
      '($data =~ /warn/i)'       => 'Warn' },

StatusHistoryLimit

Limit to storing the last 30 status changes

    StatusHistoryLimit => 30,

ExpireAfter
    ExpireAfter => (<Interval> * 3) seconds

Description
    Description = qq(
        This object follows the output of the specified log file watching for 
        warnings or errors. ),

SEE ALSO

Top

VBTK::Wrapper
VBTK::Parser
VBTK::ClientObject
VBTK::Server

AUTHOR

Top

Brent Henry, vbtoolkit@yahoo.com

COPYRIGHT

Top


VBTK documentation  | view source Contained in the VBTK distribution.