11.5. Logging the Action

Apache offers a wide range of options for controlling the format of the log files. In line with current thinking, older methods (RefererLog, AgentLog, and CookieLog) have now been replaced by the config_log_module. To illustrate this, we have taken ... /site.authent and copied it to ... /site.logging so that we can play with the logs:

User webuser Group webgroup ServerName www.butterthlies.com IdentityCheck on NameVirtualHost 192.168.123.2 <VirtualHost www.butterthlies.com> LogFormat "customers: host %h, logname %l, user %u, time %t, request %r, status %s,bytes %b," CookieLog logs/cookies ServerAdmin sales@butterthlies.com DocumentRoot /usr/www/site.logging/htdocs/customers ServerName www.butterthlies.com ErrorLog /usr/www/site.logging/logs/customers/error_log TransferLog /usr/www/site.logging/logs/customers/access_log ScriptAlias /cgi_bin /usr/www/cgi_bin </VirtualHost> <VirtualHost sales.butterthlies.com> LogFormat "sales: agent %{httpd_user_agent}i, cookie: %{http_Cookie}i, referer: %{Referer}o, host %!200h, logname %!200l, user %u, time %t, request %r, status %s,bytes %b," CookieLog logs/cookies ServerAdmin sales_mgr@butterthlies.com DocumentRoot /usr/www/site.logging/htdocs/salesmen ServerName sales.butterthlies.com ErrorLog /usr/www/site.logging/logs/salesmen/error_log TransferLog /usr/www/site.logging/logs/salesmen/access_log ScriptAlias /cgi_bin /usr/www/cgi_bin <Directory /usr/www/site.logging/htdocs/salesmen> AuthType Basic AuthName darkness ...

Get Apache: The Definitive Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.