By default polliwog will process a single log file.
It is possible to configure polliwog to process multiple log files in succession. To do this you need to provide a
log file iterator. A log file iterator should be an object that implements interface:
org.polliwog.utils.LogFileIterator.
You should then add the following to the property to the
properties file:
<property id="logFileIteratorClass"
type="string">
<description>Will iterate over a number of log files.</description>
<value>[full classname of your implementation]</value>
</property>
A basic log file iterator implementation is provided with polliwog. It is implemented by class:
org.polliwog.utils.BasicLogFileIterator. To make polliwog use this iterator you should add property:
logFileIteratorClass
to the
properties file.
The basic log file iterator supports the following features:
- Process all files from one or more directories
- Process one or more files from any directory
- Process log files accessible via http or https
- Process rolling log files (based on the date embedded in the file/directory name)
- Process zipped or gziped log files
The iterator is initialized by the xml file specified by
property:
basicLogFileIteratorFile
The xml file has the following elements/attributes:
XML Definition Help
The Children column shows the child elements that can be used within the specified element. Child elements can appear in any order (there is no enforcement via a DTD).
- A + after the element name indicates that at least 1 child element with that name must be present.
- A * after the element name indicates that 0 or more elements can be present.
- A ? after the element name indicates that either 1 or no elements with that name can be present.
If no symbol is provided after the name then one element must be provided.
The Attributes column shows the attribute that can be used on the specified element. Attribute definitions are defined as: name(value_type,required|optional), where value_type is one of:
- string - A string value, this can be anything.
- integer - An integer value.
- class - A fully qualified classname.
- enum{values} - A specific value, one or more of those given in the brackets, which will be comma-separated.
- boolean - Either
true or false .
Required and optional are represented as: R and O respectively.
|
Name | Root | Children | Parent(s) | Attributes | Description |
---|
log-file-iterator | Y | dir*, file* | NONE | NONE | The root element. |
dir | N | file* | log-file-iterator | path(string,R), format(string,O), type(enum{date},O) | Defines a directory that will contain log files. The path attribute specified the full path to the directory.
The format attribute should only be used when you want to provide a date in the directory/file name. If provided the type attribute should be: date indicating that the date format provided by SimpleDateFormat should be used. The format attribute should then contain the file name of the log files to process with format characters embedded to indicate the date. The iterator will then examine all files in the directory specified by the path attribute and compare the file name to the format specified, if it matches then the log file will be added for processing. The iterator will order the log files found from oldest to newest.
If any child file elements are specified then the content of the file element is appended to the path attribute and taken to be a file to be processed. |
file | N | NONE | dir, log-file-iterator | path | When specified as a child of dir the content of the element is used to indicate the name of a file to be processed. When specified as a child of log-file-iterator the path attribute should be provided giving the full path/url to the log file. |
Examples
Process all log files in a directory with a date in the file name.
<dir path="/home/mydir/logs"
format="'server_access_'yyyy_MM_dd'.log'"
type="date" />
Process specific files in a directory.
<dir path="/home/mydir/logs">
<file>server_access_2007_05_01.log</file>
<file>server_access_2007_05_02.log</file>
</dir>
Process a specific file.
<file path="/home/mydir/logs/server_access_2007_05_01.log" />
Process all files in directories with a date in the path.
<dir path="/home/mydir/logs"
format="yyyy_MM"
type="date" />