3

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.

2
  • 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. Commented Sep 21, 2011 at 20:13
  • It's running on RHEL, but I could do some post-processing of the logs if need be. Commented Sep 21, 2011 at 20:31

2 Answers 2

3

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.

1
  • 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... Commented Sep 23, 2011 at 16:51
0

There is this sourceforge project

3
  • 3
    Last updated 2001; would be a bit scared to use that! Commented Sep 21, 2011 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. Commented Sep 22, 2011 at 16:17
  • Code that doesn't need to be updated, isn't updated. Code has no Best-before date; you need to inspect the code with your eyes instead of a raised nose! Commented Mar 12, 2019 at 19:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.