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

Important: Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. Apple assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. Apple provides this only as a convenience to our users. Apple has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and Apple assumes no responsibility in this regard. Please understand that a third-party site is independent from Apple and that Apple has no control over the content on that website. Please contact the vendor for additional information.
Not helpful Somewhat helpful Helpful Very helpful Solved my problem
Ask other users about this article
in Apple Support Communities
See all questions on this article See all questions I have asked