org.rhq.core.pluginapi.util
Class ResponseTimeLogParser
java.lang.Object
org.rhq.core.pluginapi.util.ResponseTimeLogParser
public class ResponseTimeLogParser
- extends Object
This is a very simple log parser that uses a StringTokenizer instead of a regular expression to parse a HTTP
response-time log file. This should greatly improve the performance. It requires that lines in the log file have the
following format (with one line per HTTP request):
URL date_in_milliseconds time_taken [status_code [IP_address]]
This is the output format used by the Apache RT module, as well as the servlet RT filter.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_TIME_MULTIPLIER
public static final int DEFAULT_TIME_MULTIPLIER
- See Also:
- Constant Field Values
log
protected final org.apache.commons.logging.Log log
logFile
protected File logFile
excludes
protected List<Pattern> excludes
transforms
protected List<RegexSubstitution> transforms
ResponseTimeLogParser
public ResponseTimeLogParser(File logFile)
ResponseTimeLogParser
public ResponseTimeLogParser(File logFile,
double timeMultiplier)
parseLog
public void parseLog(CallTimeData callTimeData)
throws IOException
- Parse the log file, starting at the offset corresponding to the file's size after the last time this method was
called. Immediately after parsing, the file will be truncated, permissions permitting. If the log file does not
exist, a warning will be logged and the method will return. The parsed response-time data will be added to the
passed-in CallTimeData object.
- Parameters:
callTimeData
- the parsed response-time data will be added to this object
- Throws:
IOException
- if an error occurs reading the log file
isExcluded
protected boolean isExcluded(String url)
applyTransforms
protected String applyTransforms(String url)
parseLine
@NotNull
protected ResponseTimeLogParser.LogEntry parseLine(String line)
throws Exception
- Parses a line from a response time log and returns a LogEntry.
- Parameters:
line
- the line to be parsed
- Returns:
- a LogEntry representing the line
- Throws:
Exception
- if parsing of the line fails
getLogFile
public File getLogFile()
setLogFile
public void setLogFile(File logFile)
getTimeMultiplier
public double getTimeMultiplier()
getExcludes
public List<Pattern> getExcludes()
setExcludes
public void setExcludes(List<Pattern> excludes)
getTransforms
public List<RegexSubstitution> getTransforms()
setTransforms
public void setTransforms(List<RegexSubstitution> transforms)
Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.