dev@glassfish.java.net

Re: [PROPOSAL] More fine-grained access logging of HTTP request headers

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 04 May 2007 14:35:47 -0700

Jan Luehe wrote On 04/30/07 18:04,:

> The semantics of the "%header.<name>%" and "%cookie.value%"
> access-log tokens in domain.xml are too limiting, in that they don't
> account for multi-valued request headers, and they don't allow an
> administrator to select, or narrow down (by cookie name) the cookie
> information that is relevant to them.


Just FYI: Support for the following new access-log format tokens
will be available starting with the upcoming GlassFish v2 build 46:

  %attribute.<name>%
  -> Logs the value of the request attribute with the given name,
     or NULL-ATTRIBUTE-<name>

  %cookie%
  -> Logs the name and value of the first request cookie, or NULL-COOKIE

  %cookies%
  -> Logs the names and values of all request cookies (separated by
semicolon),
     or NULL-COOKIES

  %cookie.<name>%
  -> Logs the value of the first request cookie with the given name,
     or NULL-COOKIE-<name>

  %cookies.<name>%
  -> Logs the values of all request cookies with the given name
     (separated by semicolon), or NULL-COOKIES-<name>

  %headers.<name>%
  -> Logs the values of all request headers with the given name
     (separated by semicolon), or NULL-HEADERS-<name>


Jan



>
> Currently, these tokens, which have been around since iAS7, cause the
> following information about an HTTP request to be access-logged:
>
> %header.<name>%
>
> -> Logs the value of the first (in case there are multiple) request
> header
> with the given <name>, or NULL-HEADER-<name> if no header with
> the given
> <name> is present in the request.
> Equivalent to
> javax.servlet.http.HttpServletRequest.getHeader(<name>).
>
> Example:
>
> <access-log format="%header.Cookie%"/>
>
>
> %cookie.value%
>
> -> Logs the value of the first Cookie request header, or
> NULL-COOKIE-VALUE
> if no cookies are present in the request.
>
>
> I suggest we define the following new access-log format tokens in
> domain.xml:
>
>
> %headers.<name>%
>
> -> Logs the values of all request headers with the given <name>, or
> NULL-HEADER-<name> if no headers with the given <name> are present
> in the request.
> Equivalent to
> javax.servlet.http.HttpServletRequest.getHeaders(<name>).
>
> Example:
>
> <access-log format="%headers.Cookie%"/>
>
>
> %cookie%
>
> -> Same as %cookie.value%
>
>
> %cookies%
>
> -> Logs the values of all Cookie request headers, or NULL-COOKIE-VALUE
> if no cookies are present in the request.
> Equivalent to javax.servlet.http.HttpServletRequest.getCookies()
>
>
> %cookie.<name>%
>
> -> Logs the value of the first Cookie with the given <name>, or
> NULL-COOKIE-VALUE if no cookies with the given <name> are
> present in
> the request.
>
> Example:
>
> <access-log format="%cookie.JSESSIONID%"/>
>
>
> %cookies.<name>%
>
> -> Logs the values of all Cookies with the given <name>, or
> NULL-COOKIE-VALUE if no cookies with the given <name>
> are present in the request.
>
> Example:
>
> <access-log format="%cookies.JSESSIONID%"/>
>
>
> %attribute.<name>%
>
> -> Logs the value of the request attribute with the given <name>, or
> NULL-ATTRIBUTE-<name> if no attribute with the given <name> is
> present
> in the request.
> Equivalent to javax.servlet.ServletRequest.getAttribute(<name>).
>
>
> The new tokens will not require any modifications to the DTD that
> governs domain.xml, because the "format" attribute of <access-log> is
> of type CDATA.
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>