Class AccessLogFormatParser
- java.lang.Object
-
- io.micronaut.http.server.netty.handler.accesslog.element.AccessLogFormatParser
-
public class AccessLogFormatParser extends java.lang.ObjectThe access log format parser. The syntax is based on Apache httpd log format. Here are the supported directives:- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name
- %H - Request protocol
- %{
}i - Request header. If the argument is omitted (%i) all headers will be printed - %{
}o - Response header. If the argument is omitted (%o) all headers will be printed - %{
}C - Request cookie (COOKIE). If the argument is omitted (%C) all cookies will be printed - %{
}c - Response cookie (SET_COOKIE). If the argument is omitted (%c) all cookies will be printed - %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %p - Local port
- %q - Query string (excluding the '?' character)
- %r - First line of the request
- %s - HTTP status code of the response
- %{
}t - Date and time. If the argument is omitted the Common Log Format format is used ("'['dd/MMM/yyyy:HH:mm:ss Z']'"). If the format starts with begin: (default) the time is taken at the beginning of the request processing. If it starts with end: it is the time when the log entry gets written, close to the end of the request processing. The format should follow the DateTimeFormatter syntax. - %u - Remote user that was authenticated. Not implemented. Prints '-'.
- %U - Requested URI
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
In addition, the following aliases for commonly utilized patterns:
- common -
%h %l %u %t "%r" %s %bCommon Log Format (CLF) - combined -
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"Combined Log Format
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMBINED_LOG_FORMATThe combined log format.static java.lang.StringCOMMON_LOG_FORMATThe common log format.
-
Constructor Summary
Constructors Constructor Description AccessLogFormatParser(java.lang.String spec)Creates an AccessLogFormatParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessLognewAccessLogger()Returns a new AccessLogger for the specified log format.java.lang.StringtoString()
-
-
-
Field Detail
-
COMBINED_LOG_FORMAT
public static final java.lang.String COMBINED_LOG_FORMAT
The combined log format.- See Also:
- Constant Field Values
-
COMMON_LOG_FORMAT
public static final java.lang.String COMMON_LOG_FORMAT
The common log format.- See Also:
- Constant Field Values
-
-
Method Detail
-
newAccessLogger
public AccessLog newAccessLogger()
Returns a new AccessLogger for the specified log format.- Returns:
- A AccessLogger.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-