TPTP 4.4.0 Monitoring Tools Project
Public API Specification

org.eclipse.hyades.logging.parsers
Class AbstractErrorLogParser

java.lang.Object
  extended byorg.eclipse.hyades.logging.parsers.Parser
      extended byorg.eclipse.hyades.logging.parsers.MonitoringParser
          extended byorg.eclipse.hyades.logging.parsers.AbstractErrorLogParser
All Implemented Interfaces:
IParser
Direct Known Subclasses:
ApacheErrorLogParser

public abstract class AbstractErrorLogParser
extends MonitoringParser

AbstractErrorLogParser is the abstract superclass for the ApacheErrorLogParser.

For each error log record, this class parses the time stamp, message category, client IP address and message. This method also has a simplistic algorithm for finding a file name in the message field. This parsed information and information about the local machine (machine where the parse is performed, but not necessarily the machine that produced the error log) is used to produce a org.eclipse.hyades.logging.events.cbe.CommonBaseEvent object for each record.

See Also:
Parser, CommonBaseEvent

Field Summary
protected  java.lang.String category
          Parsed value of the category field.
protected  java.lang.StringBuffer cgiDebuggingOutput
          CGI debugging output.
protected  java.lang.String clientIP
          Parsed value of the client's IP address field.
protected  java.lang.StringBuffer currentTimeStamp
          Parsed value of the time stamp field converted to the XML dateTime format.
protected  java.lang.String fileName
          File name found in the message field.
protected  java.lang.String message
          Parsed value of the message field.
protected  java.lang.String productVersion
          User-supplied value of the version of the web server product.
protected  FilterExitHelper sensorFilterExitHelper
          The filter exit helper object is used to retrieve filter exit data
protected  short severity
          Severity associated mapped from the category.
protected  java.lang.String sourceID
          Web server product name and version supplied by the subclass.
 
Fields inherited from class org.eclipse.hyades.logging.parsers.Parser
arrayIndex, bytesRead, charset, curLine, curLineNumber, defaultArraySize, enableICU, EOL_CHARS, EOL_LAST_CHAR, eventFactory, file_path, fileLocale, fileULocale, filter, filterExitClass, filterExitClassInstance, flushingMode, lastOffset, localHostId, localHostIdFormat, localHostName, logBuffer, logBufferInitialSize, logFile, logger, MessageArraySize, messages, mfr, originLocale, prefix, processedSize, recordCount, seqNums, tmpFile, totalSize, UNKNOWN_HOST
 
Constructor Summary
AbstractErrorLogParser()
           
 
Method Summary
protected  boolean parseDate(int startIndex, int endIndex)
          Parses a time stamp from an access log record, produces a Date object from the parsed information, and converts the Date object into a XML DateTime String.
protected  boolean parseLogRecord()
          Main parsing routine for an error log record.
 org.eclipse.hyades.logging.events.cbe.CommonBaseEvent[] parseNext()
          Parses each error log record and produces a Common Base Event (CBE) object that is returned as a member of a CBE array.
 void postParse()
          De-constructs this parser (e.g. closes the log file handle).
 void preParse()
          Initialize this parser.
protected  void reset()
          Resets the parsed values of a log record before next record is parsed.
 void setConfiguration(java.util.Hashtable table)
          This function is called to provide user-specified information to the parser.
 
Methods inherited from class org.eclipse.hyades.logging.parsers.MonitoringParser
getFilePointer, isEndOfFile, readALine, readLine, setConverterCommand, setConverterCommand, setEndOfFile, setFilename
 
Methods inherited from class org.eclipse.hyades.logging.parsers.Parser
createStringEDE, getFilterExitClassInstance, getLocale, getLocalHostId, getMessages, getName, getParserLogger, getProcessedSize, getTotalSize, getVersion, increaseMsgArraySize, isChar, isFlushingMode, isLet, isLet, isNum, isNum, parse, setFlushingMode, setParserLogger, setUserInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

category

protected java.lang.String category
Parsed value of the category field.


severity

protected short severity
Severity associated mapped from the category.


clientIP

protected java.lang.String clientIP
Parsed value of the client's IP address field.


message

protected java.lang.String message
Parsed value of the message field.


fileName

protected java.lang.String fileName
File name found in the message field.


cgiDebuggingOutput

protected java.lang.StringBuffer cgiDebuggingOutput
CGI debugging output. NOTE: Must be initialized to an empty string buffer.


currentTimeStamp

protected java.lang.StringBuffer currentTimeStamp
Parsed value of the time stamp field converted to the XML dateTime format. NOTE: Must be initialized to null.


productVersion

protected java.lang.String productVersion
User-supplied value of the version of the web server product. Instantiated in the setUserInput method of the subclass.


sourceID

protected java.lang.String sourceID
Web server product name and version supplied by the subclass.


sensorFilterExitHelper

protected FilterExitHelper sensorFilterExitHelper
The filter exit helper object is used to retrieve filter exit data

Provisional API: This API is subject to change in the next release.
As of TPTP V4.4.0, this is stable provisional API (see http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).
Constructor Detail

AbstractErrorLogParser

public AbstractErrorLogParser()
Method Detail

setConfiguration

public void setConfiguration(java.util.Hashtable table)
                      throws LogParserException
Description copied from class: MonitoringParser
This function is called to provide user-specified information to the parser. Currently, this superclass method handles the path and name of the log file to be parsed. Subclasses will override this method to handle additional user-specified information.

Specified by:
setConfiguration in interface IParser
Overrides:
setConfiguration in class MonitoringParser
Parameters:
table - Hashtable containing keys and values of user-specified information
Throws:
LogParserException - if user-specified path and name for the log file does not exist on the parsing machine

preParse

public void preParse()
              throws LogParserException
Initialize this parser.

Specified by:
preParse in interface IParser
Overrides:
preParse in class Parser
Throws:
LogParserException - if the parser cannot be initialized.

postParse

public void postParse()
               throws LogParserException
De-constructs this parser (e.g. closes the log file handle).

Specified by:
postParse in interface IParser
Overrides:
postParse in class MonitoringParser
Throws:
LogParserException - if the parser cleanup fails

parseNext

public org.eclipse.hyades.logging.events.cbe.CommonBaseEvent[] parseNext()
                                                                  throws LogParserException
Parses each error log record and produces a Common Base Event (CBE) object that is returned as a member of a CBE array.

Specified by:
parseNext in interface IParser
Specified by:
parseNext in class Parser
Returns:
CommonBaseEvent[] array of CBE's representing parsed records.
Throws:
LogParserException - if the parser is unable to parse the error log

parseDate

protected boolean parseDate(int startIndex,
                            int endIndex)
Parses a time stamp from an access log record, produces a Date object from the parsed information, and converts the Date object into a XML DateTime String.

Parameters:
startIndex - Starting index of time stamp in curLine.
endIndex - Ending index of time stamp in curLine.
Returns:
true if time stamp is valid; otherwise false.

parseLogRecord

protected boolean parseLogRecord()
Main parsing routine for an error log record.

Returns:
true if the error log record is successfully parsed; otherwise false.

reset

protected void reset()
Resets the parsed values of a log record before next record is parsed.


TPTP 4.4.0 Monitoring Tools Project
Public API Specification