public class DetailByDetailProcessor extends LogReformatProcessor
LogReformatProcessor
sub-class is used to transform logs in
a more detail-oriented manner. This allows the user to perform operations
such as reordering log details or changing the format of a particular log
detail (such as a date-time).
For example, when switching from IIS7 to the Apache/Combined format, we
start with a log that looks like this:
2014-12-01 06:00:47 10.10.1.46 GET /merb/merxbrowser/help/Content/About+the+mission/MSL/Instruments/MSL+Navcam.htm - 443 - 66.249.69.46 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) - 200 0 0 10757 314 312
We want to reformat this log into something that looks like this:
66.249.69.46 - - [01/Dec/2014:06:00:47 -0800] "GET /merb/merxbrowser/help/Content/About+the+mission/MSL/Instruments/MSL+Navcam.htm HTTP/1.1" 200 10757 "-" "Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)"
To make this happen, we specify the input line specification like this:
Modifier and Type | Field and Description |
---|---|
static String |
OUTPUT_DIR_NAME |
inputDetailMap, outputDetailMap, segmentedInput, segmentedOutput
Constructor and Description |
---|
DetailByDetailProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Properties props)
Configure the Processor, providing the details needed to process logs.
|
String |
getDirName()
Get the name of the directory where the output of the processor is
placed.
|
protected String |
getNextDetail(String lineRemaining,
int segmentIndex,
LogDetail detail,
String line)
Get the value of the next detail in the remaining input log line.
|
String |
getOutputFileName(String inputFileName)
Get the name that will be assigned to an output file, given the input
file name.
|
protected void |
parseInputLine(String line)
Parse a line from an input file and extract the values for presented
details (e.g.
|
configure, determineErrorTolerance, formatOutputLine, parseInputSpec, parseOutputSpec, process, process, processFile, processFileList, processLine, resetDetailMaps, validateLineSpecs, verifyConfiguration
public static final String OUTPUT_DIR_NAME
public String getDirName()
Processor
gov.nasa.pds.report.processing.Processor.getDirName()
public void configure(Properties props) throws ProcessingException
Processor
props
- A Properties
containing the needed
configuration values.ProcessingException
- If the provided Properties do not contain
the needed configuration values.gov.nasa.pds.report.processing.Processor.configure()
public String getOutputFileName(String inputFileName)
Processor
inputFileName
- The name of the input filegov.nasa.pds.report.processing.LogReformatProcessor.getOutputFileName()
protected void parseInputLine(String line) throws ProcessingException
LogReformatProcessor
parseInputLine
in class LogReformatProcessor
line
- The input line, presented as a String.ProcessingException
- If a required detail is not defined, or if
the line cannot be properly parsed using
the pattern provided during configuration.gov.nasa.pds.report.processing.LogReformatProcessor.parseInputLine()
protected String getNextDetail(String lineRemaining, int segmentIndex, LogDetail detail, String line) throws ProcessingException
lineRemaining
- The portion of the input log line that has
not yet been processed.segmentIndex
- The segment index used to determine if the
log detail sought is at the end of the input
log line.detail
- The LogDetail
sought at the start of
the remaining input log line.line
- The input log line.ProcessingException
- If the value for a required log detail is
not provided or the start of the remaining
log input line does not match the pattern
provided for the log detail being sought.Copyright © 2010–2016 Planetary Data System. All rights reserved.