org.apache.hadoop.contrib.failmon
Class SystemLogParser

java.lang.Object
  extended by org.apache.hadoop.contrib.failmon.LogParser
      extended by org.apache.hadoop.contrib.failmon.SystemLogParser
All Implemented Interfaces:
Monitored

public class SystemLogParser
extends LogParser

An object of this class parses a Unix system log file to create appropriate EventRecords. Currently, only the syslogd logging daemon is supported.


Constructor Summary
SystemLogParser(String fname)
          Create a new parser object .
 
Method Summary
 String getInfo()
          Return a String with information about this class
protected  Calendar parseDate(String strDate, String strTime)
          Parse a date found in the system log.
 EventRecord parseLine(String line)
          Parses one line of the log.
 
Methods inherited from class org.apache.hadoop.contrib.failmon.LogParser
checkForRotation, getNext, getReader, monitor, monitor, setNetworkProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemLogParser

public SystemLogParser(String fname)
Create a new parser object .

Method Detail

parseLine

public EventRecord parseLine(String line)
                      throws IOException
Parses one line of the log. If the line contains a valid log entry, then an appropriate EventRecord is returned, after all relevant fields have been parsed.

Specified by:
parseLine in class LogParser
Parameters:
line - the log line to be parsed
Returns:
the EventRecord representing the log entry of the line. If the line does not contain a valid log entry, then the EventRecord returned has isValid() = false. When the end-of-file has been reached, null is returned to the caller.
Throws:
IOException

parseDate

protected Calendar parseDate(String strDate,
                             String strTime)
Parse a date found in the system log.

Specified by:
parseDate in class LogParser
Returns:
a Calendar representing the date

getInfo

public String getInfo()
Return a String with information about this class

Returns:
A String describing this class


Copyright © 2009 The Apache Software Foundation