Access Log Patterns and Nicknames

Access Log Patterns and Nicknames

Access Log Patterns and Nicknames

    GlassFish v2 makes it easier to specify well-known access log patterns, by allowing you to specify access log patterns by their well-established nicknames.

    In GlassFish, you normally use the format attribute of the <access-log> subelement of <http-service> to specify the access log pattern of your virtual servers.

    The default access log pattern looks like this:

    
      format="%client.name% %auth-user-name% %datetime% %request% %status% %response.length%"
    
    

    The above are just a subset of the access log pattern tokens supported by GlassFish. The complete list of access log pattern tokens, from which you can assemble your own custom access log pattern, is as follows:

    
      %auth-user-name%
      %client.dns%
      %client.name%
      %cookie.value%
      %datetime%
      %header.accept%
      %header.%
      %header.auth%
      %header.date%
      %header.if-mod-since%
      %header.user-agent%
      %header.referer%
      %http-method%
      %http-uri%
      %http-version%
      %query-str%
      %referer%
      %request%
      %response.length%
      %status%
      %user.agent%
      %vs.id%
    
    

    Due to popular demand, GlassFish v2 supports shortcuts for well known access log patterns, allowing you to specify an access log pattern by its nickname, instead of having to list its constituent tokens.

    Currently, the following access log pattern nicknames are supported:

    Additional nicknames will be added in the future, based on the GlassFish community's input.

    So, in order to change the access log pattern from the GlassFish default to Apache's "common" format, all you need to do is issue the following asadmin command (or use the admin gui):

    
      asadmin set server.http-service.access-log.format="common"
    
    
    or to change it to Apache's "combined" format, issue this command:
    
      asadmin set server.http-service.access-log.format="combined"
    
    
    Provided that access logging has been enabled, the above commands will take effect immediately, without requiring a server restart.
Comments:

Just great news :o)

Posted by bjb on March 18, 2007 at 08:08 PM PDT #

It'd be great if you'd link to some references (to the Glassfish documentation) on information like this, when you post.

Posted by thundt on July 20, 2007 at 03:43 AM PDT #

I need to log the request size, in order to debug an excessive "In Traffic" I've noticed from the snmp monitoring.

I've tried adding %request.size% prior to finding this blog, with no sucess.

Do you have any clue for me ?

TIA,

Posted by Fernando Braga on August 05, 2008 at 10:31 PM PDT #

Jan, you rock :-)

Posted by Newb on September 03, 2008 at 07:01 AM PDT #

I was searching for more information about the log generation to glassfish and yours, help me.
Thank you!
Marcio Wesley Borges
http://www.marciowb.net/

Posted by Marcio Wesley Borges on March 20, 2009 at 11:59 PM PDT #

Important addition to your list -
%time-taken%

Posted by vromanov on December 02, 2009 at 06:52 PM PST #

I need to add the cookie value to the the combined log's for Urchin to work.

in Apache this will be done with this:

LogFormat "%h %v %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\" \\"%{Cookie}i\\"" urchin

Can this be duplicated in Glassfish?

Posted by Santos on February 24, 2010 at 07:15 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

jluehe

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today