Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is is possible to configure Apache to reliably generate access logs in W3C extended format idential to that generated by IIS? I can't seem to track down a detailed description of specifics like delimiters, field formats, etc. No doubt there is an apache log format string that can do it, but I don't have enough info to create or even know for sure if it can write the data in the correct format.

I am using a web access log analyzer (SmarterStats) that does not support custom log file formats - it only supports Common Log Format, or W3C extended format. Unfortunately CLF has only very limited data, so doesn't allow particularly interesting analysis.

share|improve this question
    
what OS are you running Apache on? I ask because depending on OS, there may be a tool that can help you transform your output to be more in line with what you're looking for. –  SeanKilleen Sep 21 '11 at 20:13
    
It's running on RHEL, but I could do some post-processing of the logs if need be. –  Rob Sep 21 '11 at 20:31
add comment

2 Answers 2

The W3C Extended Log File Format lets you define a set of fields in metadata at the top of the log. The defaults for IIS 6 seem to be:

#Fields: date time c-ip cs-username s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status cs(User-Agent)

You should check your IIS log to see that this is the case (and what your parser expects) - look for the #Fields line at the top.

You can generate an Apache log in this format using a LogFormat line something like this:

LogFormat "%{%Y-%m-%d %H:%M:%S}t %a %u %A %p %m %U %q %>s \"%{User-agent}i\"" w3c_extended
CustomLog /var/log/apache2/extended_access_log w3c_extended

(I can't test this at present: please edit the post or comment if you try it).

Check Apache's custom log formats to see how I derived that.

share|improve this answer
    
This is what I would have done, but it turns out that SmarterStats requires the header/metadata at the top of the log like IIS produces. Back to the drawing board... –  Rob Sep 23 '11 at 16:51
add comment

There is this sourceforge project

share|improve this answer
2  
Last updated 2001; would be a bit scared to use that! –  crb Sep 21 '11 at 20:44
    
Nice find, but with over a decade since the code was last updated... Would be a good place to start though, if I need to go the route of writing a custom logging module. –  Rob Sep 22 '11 at 16:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.