|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbe.unamur.inference.web.apache.ApacheLogFormatPatternBuilder
public class ApacheLogFormatPatternBuilder
This class is used to generate regular expression Patterns to parse
Apache web log entries. The patterns are built using groups names by the
different static Strings declared in this class. The usage of this class is
to get the singleton instance using getInstance() method and to call the
buildPattern method on this object using one of the constants defining a
format: COMMON_LOG_FORMAT, COMBINED_LOG_FORMAT, REQUEST_FORMAT, or
DATE_FORMAT. The returned Pattern is used to match a given string and
the resulting Matcher object may return the different groups of the
used pattern using the names defined in the _DIRECTIVE constants (see
http://httpd.apache.org/docs/ for the different log formats). Example:
{
@code
Pattern pattern = getInstance().buildPattern(COMMON_LOG_FORMAT);
Matcher match = pattern.matcher(logLine);
String request = match.group(REQUEST_DIRECTIVE);
String host = match.group(HOST_DIRECTIVE);
}
| Field Summary | |
|---|---|
static String |
COMBINED_LOG_FORMAT
The combined Apache web log format regular expression. |
static String |
COMMON_LOG_FORMAT
The common Apache web log format regular expression. |
static String |
DATE_FORMAT
Date format used in Apache logs. |
static Locale |
DATE_LOCALE
The Locale value used in the dates of the log. |
static String |
HOST_DIRECTIVE
The host directive group name. |
static String |
IDENTITY_DIRECTIVE
The identity directive group name. |
static String |
REFERRER_DIRECTIVE
The referrer directive group name. |
static String |
REQUEST_DIRECTIVE
The request directive groupe name. |
static String |
REQUEST_FORMAT
The Apache request format regular expression. |
static String |
REQUEST_METHOD_DIRECTIVE
The request method directive group name. |
static String |
REQUEST_PROTOCOL_DIRECTIVE
The request protocole directive group name. |
static String |
REQUEST_QUERY_PARAMETERS_DIRECTIVE
The request query parameters directive group name. |
static String |
REQUEST_QUERY_PATH_DIRECTIVE
The request query path directive group name. |
static String |
SIZE_DIRECTIVE
The size directive group name. |
static String |
STATUS_CODE_DIRECTIVE
The status code directive group name. |
static String |
TIME_DIRECTIVE
The time directive group name. |
static String |
USER_AGENT_DIRECTIVE
The user agent directive group name. |
static String |
USER_DIRECTIVE
The user directive group name. |
| Method Summary | |
|---|---|
com.google.code.regexp.Pattern |
buildPattern(String format)
Return a pattern corresponding to the given regular expression string. |
static ApacheLogFormatPatternBuilder |
getInstance()
Return the instance of this singleton class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String HOST_DIRECTIVE
public static final String IDENTITY_DIRECTIVE
public static final String USER_DIRECTIVE
public static final String TIME_DIRECTIVE
public static final String REQUEST_DIRECTIVE
public static final String STATUS_CODE_DIRECTIVE
public static final String SIZE_DIRECTIVE
public static final String REFERRER_DIRECTIVE
public static final String USER_AGENT_DIRECTIVE
public static final String REQUEST_METHOD_DIRECTIVE
public static final String REQUEST_QUERY_PATH_DIRECTIVE
public static final String REQUEST_QUERY_PARAMETERS_DIRECTIVE
public static final String REQUEST_PROTOCOL_DIRECTIVE
public static final String COMMON_LOG_FORMAT
public static final String COMBINED_LOG_FORMAT
public static final String REQUEST_FORMAT
public static final String DATE_FORMAT
public static final Locale DATE_LOCALE
Locale value used in the dates of the log. This value has to
be provided to DateParser objects.
| Method Detail |
|---|
public static ApacheLogFormatPatternBuilder getInstance()
public com.google.code.regexp.Pattern buildPattern(String format)
format - The format of the regular expression.
Pattern corresponding tot the given regular expression
string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||