NAME
MQSeries::ErrorLog::Parser -- Parse a portion of an MQSeries error log and return parsed Entry objects.
SYNOPSIS
use MQSeries::ErrorLog::Parser;
my $qmgr = 'foo'; # Queue Manager we are processing
my $parser = MQSeries::ErrorLog::Parser->
new('defaults' => { 'QMgr' => $qmgr });
open (ERRORS, '<', "/var/mqm/qmgrs/$qmgr/errors/AMQERR01.LOG");
local $/;
my @entries = $parser->parse_data(<ERRORS>);
close ERRORS;
DESCRIPTION
The MQSeries::ErrorLog::Parser class is typically not used directly, but invoked through the MQSeries::ErrorLog::Tail class. When used directly, it can be used to parse a (possibly archived) error-log file and return an array of neatly-parsed MQSeries::ErrorLog::Entry objects.
This class will try and deal with the vagaries of error-log processing, chief of which is that the MQSeries error-log is not written to in an atomic fashion, meaning that some error-log entries may be interleaved and hence un-parseable.
All error-log entries can be parsed to some extent (summary, action, timestamp); however, most common error messages are also parsed in detail to give access to embedded fields such as 'QMgr', 'Channel', 'Queue', etc.
METHODS
new
Create a new MQSeries::ErrorLog::Parser object. The constructor take the following optional parameters:
- Carp
-
A reference to an error-handling routine. This defaults to 'carp', but can be changed to your own error-handling routine.
In order to avoid overloading the system with error messages, message format errors are not logged and errors for specific error-log messages are generated only once for each message code.
- defaults
-
A reference to a hash with default parameters that will be used to initialize the MQSeries::ErrorLog::Entry object created. A typical default parameter is 'QMgr', which should be specified whenever you are parsing error-log messages for a specific queue manager.
parse_data
Parse a chunk of text with one or more error messages and return individual parsed entries.
FILES
The file 'descriptions.pl' contains a list of all error messages supported, in the form of regular expressions and a set of field names extracted from these expressions. Additions and corrections are welcome.
SEE ALSO
MQSeries(3), MQSeries::ErrorLog::Tail(3), MQSeries::ErrorLog::Entry(3)