NAME
MQSeries::ErrorLog::Tail -- Watch MQSeries error-log files
SYNOPSIS
use MQSeries::ErrorLog::Tail;
my $err_log = new MQSeries::ErrorLog::Tail("/var/mqm/errors");
while (1) {
my @entries = $err_log->process();
process_errorlog_entries(@entries) if (@entries);
sleep(10) unless (@entries);
}
sub process_errorlog_entries {
my (@errlog_entries) = @_;
foreach my $entry (@errlog_entries) {
# Send off to syslog or whatever
}
}
DESCRIPTION
The MQSeries::ErrorLog::Tail class provides a mechanism to watch the MQSeries errorlog (AMQERR01.LOG), which is generally written to whenever an MQSeries error occurs, or when certain events happen.
Every time the process() method is invoked, it will return a (possibly empty) array of MQSeries::ErrorLog::Entry objects, which can in turn be analyzed and shipped off to syslog or other monitoring tools.
The MQSeries::ErrorLog::Tail class will notice file roll-overs (where the old AMQERR01.LOG is renamed AMQERR02.LOG and a new file AMQERR01.LOG is created). In such cases, it will first process the tail-end of the old file, then switch over to the new file.
METHODS
new
Create a new MQSeries::ErrorLog::Tail object. The argument is the directory to watch (/var/mqm/errors for a typical installation's system-wide global error log, /var/mqm/qmgrs/XYZ/errors for a typical installation's queue-manager specific error log).
process
Process any changes since the previous invocation (or the constructor). Read any data found, parse it and return the MQSeries::ErrorLog::Entry objects that were read.
SEE ALSO
MQSeries(3), MQSeries::ErrorLog::Parser(3), MQSeries::ErrorLog::Entry(3), MQSeries::FDC::Tail(3)