TPTP 4.4.0 Monitoring Tools Project
Public API Specification

org.eclipse.hyades.logging.parsers
Class AbstractAccessLogParser

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

public abstract class AbstractAccessLogParser
extends MonitoringParser

AbstractAccessLogParser is the abstract super class for the ApacheAccessLogParser.

For each access log record, this class parses the client IP address, user ID, time stamp, method, file name, return code and file size. This parsed information and information about the local machine (machine where the parse is performed, but not necessarily the machine that produced the access log) is used to produce a org.eclipse.hyades.logging.events.cbe.CommonBaseEvent object for each record. This parser is based on the Apache Common Log Format (CLF) or "%h %l %u %t \"%r\" %>s %b". For more information, see the Apache HTTP Server Version 2.0 specification (Access Log File).

See Also:
Parser, CommonBaseEvent

Field Summary
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
          Parsed value of the file name field.
protected  java.lang.String fileSize
          Parsed value of the file size field.
protected  java.lang.String message
          Parsed value of the message portion of the access log record.
protected  java.lang.String method
          Parsed value of the method field.
protected  java.lang.String productVersion
          User-supplied value of the version of the web server product.
protected  java.lang.String referer
          Parsed value of the Referer field.
protected  java.lang.String returnCode
          Parsed value of the return code field.
protected  FilterExitHelper sensorFilterExitHelper
          The filter exit helper object is used to retrieve filter exit data
protected  java.lang.String sourceID
          Web server product name and version supplied by the subclass.
protected  java.lang.String userAgent
          Parsed value of the User-agent field.
protected  java.lang.String userID
          Parsed value of the userid field.
 
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
AbstractAccessLogParser()
           
 
Method Summary
protected  void determineSeverity(org.eclipse.hyades.logging.events.cbe.CommonBaseEvent message)
          Uses the return code of the message to determine the severity.
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 access log record.
 org.eclipse.hyades.logging.events.cbe.CommonBaseEvent[] parseNext()
          Parses each access 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

clientIP

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


method

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


fileName

protected java.lang.String fileName
Parsed value of the file name field.


returnCode

protected java.lang.String returnCode
Parsed value of the return code field.


fileSize

protected java.lang.String fileSize
Parsed value of the file size field.


userID

protected java.lang.String userID
Parsed value of the userid field.


userAgent

protected java.lang.String userAgent
Parsed value of the User-agent field.


referer

protected java.lang.String referer
Parsed value of the Referer field.


message

protected java.lang.String message
Parsed value of the message portion of the access log record. The message includes the method, file name, protocol, return code, and file size fields.


currentTimeStamp

protected java.lang.StringBuffer currentTimeStamp
Parsed value of the time stamp field converted to the XML dateTime format.


cgiDebuggingOutput

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


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

AbstractAccessLogParser

public AbstractAccessLogParser()
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 access 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 access log

determineSeverity

protected void determineSeverity(org.eclipse.hyades.logging.events.cbe.CommonBaseEvent message)
Uses the return code of the message to determine the severity.

Parameters:
message - - the CommmonBaseEvent to set the severity in

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 access log record.

Returns:
true if the access 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