Mac OS X Server: Setting a web site's access.log format
Summary
When monitoring an individual site's access log at /var/log/apache2/access.log, it may be necessary to modify the format string to gather additional information.
Products Affected
Mac OS X Server 10.5, Mac OS X Server 10.6
Mac OS X Server 10.5:
1. In Server Admin select the Web service, then choose Sites.
2. Select the site you would like to modify the access log format for and highlight the Logging tab.
3. Enter the string you want in the "Format String" window and save the settings.
Mac OS X Server 10.6:
1. Open /etc/apache2/sites/your_site.conf in a text editor
2. Look for the CustomLog line and edit the string after "/var/log/apache2/access_log".
3. Verify that the quotation marks are at the beginning and end of the string before saving the file
Commonly-used format strings:
Common
%h %l %u %t "%r" %>s %b
Common Log Format with Virtual Host
%v %h %l %u %t "%r" %>s %b
Combined
%h %l %u %t "%r" %>s %b "%{REFERER}i" "%{User-Agent}i"
Referer
%{REFERER}i -> %U
Agent
%{User-agent}i
Additional Information
In Mac OS X Server v10.5, selecting the Format pop-up menu will clear any information from the Format String window. Click the Revert button at the bottom left of the window to retrieve the last saved format string.
For additional documentation on string options visit the Apache mod_log_config site at http://httpd.apache.org/docs/2.0/mod/mod_log_config.html
Twitter
Facebook