org.apache.hadoop.contrib.failmon
Class HadoopLogParser

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

public class HadoopLogParser
extends LogParser

An object of this class parses a Hadoop log file to create appropriate EventRecords. The log file can either be the log of a NameNode or JobTracker or DataNode or TaskTracker.


Constructor Summary
HadoopLogParser(String fname)
          Create a new parser object and try to find the hostname of the node that generated the log
 
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 Hadoop 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

HadoopLogParser

public HadoopLogParser(String fname)
Create a new parser object and try to find the hostname of the node that generated the log

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 Hadoop 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