<% Z::set_settings( "title" => "Client Logging", "help" => "/apps/web/docs/modules/log/index.html", "base" => "modules!log" ); $::f{back} = "/apps/web/modules.ahtml?server=$::f{server}" if( !defined $::f{back} ); ####### # The different formats we know, in the order we want to offer them to the # client @fmts = ( "NCSA Common Log format (CLF)", "NCSA Combined", "Shared NCSA CLF", "Shared NCSA Combined", "Netscape NSAPI Extended", "Zeus Extended Logging Format" ); # Mapping of format-name -> format string, need to keep @fmts and # this list in sync. %fmt_name2str = ( "NCSA Common Log format (CLF)" => '%h %l %u %t "%r" %s %b', "NCSA Combined" => '%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"', "Shared NCSA CLF" => '%{Host}i %h %l %u %t "%r" %s %b', "Shared NCSA Combined" => '%{Host}i %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"', "Netscape NSAPI Extended" => '%h %l %u %t "%r" %s %b\n"%{Referer}i" "%{User-Agent}i"', "Zeus Extended Logging Format" => '%T|%h|%M %U|%{Content-Type}o|%s|%u|%b|%{Cookie}i|%{Referer}i|%{User-Agent}i' ); # Create a reverse mapping of format string -> format-name %fmt_str2name = (); while (my($k,$v) = each %fmt_name2str ) { $fmt_str2name{$v} = $k; } %> <% Z::parse( "../../etc/editheader.ahtml" ) %>

This modules logs all client requests to the webserver in a user specified format. If multiple virtual servers specify the same log filename, the file will automatically be shared, saving system resources.


Logging Configuration
<%= Z::form( target=>$::f{back} ) %>
Log filename: " name=!filename>
Format string:
<% my $f = $::f{ '!format'}; if( defined( $fmt_str2name{$f} )) { $f = $fmt_str2name{$f}; } Z::write( Z::quote_html( $f )); %>
<%= Z::endform() %>
Choose Format String:
<%= Z::form( ) %>
<% ($iscust, $ispre) = ("", "checked"); ($iscust, $ispre) = ("checked", "") if( !defined( $fmt_str2name{ $::f{"!format"} } )); %> > Custom: ">
> Pre-defined:
<% $::f{"!format"} = $::f{formatsel} if( ($::f{which}||"") eq "quickpix" ); $::f{"!format"} = $::f{formatcust} if( ($::f{which}||"") eq "custom" ); %> <%= Z::endform() %>


Quick reference

Common Log Format (CLF) is %h %l %u %t "%r" %s %b

%...h Remote host
%...u Remote authenticated user
%...t Time, in Common Log Format time format
( e.g. [17/Jun/1996:08:23:09 +0000] )
%...T Time, in short format YYMMDD-hhmmss
%...r First line of client request
%...s Status, e.g. 302
%...b Bytes sent
%...v Server name
%...M Method, e.g. "GET"
%...U URL, e.g. "/index.html"
%...V HTTP version, e.g. "HTTP/1.0"
%...{Foobar}i The contents of Foobar: header line(s) in the request sent by the client
%...{Foobar}o The contents of Foobar: header line(s) in the reply

The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can indicate conditions for inclusion of the item (which will cause it to be replaced with '-' if the condition is not met).

The forms of condition are a list of HTTP status codes, which may or may not be preceded by '!'. Thus, '%400,501{User-agent}i' logs User-agent: on 400 errors and 501 errors (Bad Request, Not Implemented) only; '%!200,304,302{Referrer}i' logs Referrer: on all requests which did not return some sort of normal status.

If the format string is left blank, request output will be logging in an extended format compatible with earlier versions of Zeus Server. This default format is defined as

%T|%h|%M %U|%{Content-Type}o|%s|%u|%b|%{Cookie}i|%{Referer}i|%{User-Agent}i

which outputs lines in the form:

970630-140918|foo.com|GET /||200||750||http://referrer.org/|Mozilla/3.0

See the information in the documentation system for more examples and information on scaling logging for large numbers of virtual servers.

<% Z::parse( "../../etc/footer.ahtml" ) %>