faqts : Computers : Internet : Web Servers : Apache : Installation and Setup

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 18 people (67%) answered Yes
Recently 4 of 10 people (40%) answered Yes


How to change the format of log file (such as access.log, error.log)?

Nov 16th, 2001 01:13
Anthony Boyd, PH Dung,

In Apache's httpd.conf file, you'll find a line similar to this:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
Basically, there are key letters that you can use to whip up any kind 
of log lines you want.  You can read about the letters here:
Anyway, let's say we want to have a log file that is comma-separated, 
for easy import into Excel.  And we just want the user's IP address, 
and the page requested.  That's the "a" and "U" letters.  So:
LogFormat "%a,%U" csv
The "common" and "csv" you see at the end, that's just the name the log 
file is given -- you can have multiple log files going with multiple 
LogFormat directives.  That's it.