Forum Moderators: phranque

Message Too Old, No Replies

httpd.conf and log files

need a little help with log format

         

Reflection

7:39 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



I want to change my httpd.conf file so I can change the way log files are created. First here is the relevant section of what I want to change...

# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# You need to enable mod_logio.c to use %I and %O
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog logs/access.log common

#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog logs/referer.log referer
#CustomLog logs/agent.log agent

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog logs/access.log combined


The above bolded parts are the items Im not quite sure of. What I want to do is use the following:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" \"%{cookie}i\"" combined

# Specify that we want to store the combined log file in the location "logs/combined.log".
CustomLog logs/combined.log combined

So here is what I think I should do :). Uncomment the CustomLog logs/access.log combined line and add the LogFormat line. Except Im confused over the multiple LogFormat lines that are in bold above. Do I just add my new LogFormat or do I need to comment/remove the old LogFormats?

And finally Im not sure I understand the CustomLog logs/access.log common. Do I just leave that as is?

Any help would be appreciated.

lemat

9:53 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



LogFormat above defines 4 different log formats: "agent", "referer", "custom" and "combined"

just comment the old "combined" logformat
add your new "combined" logformat
and change CustomLog to your new "combined" format:

CustomLog logs/access.log combined

I'm not sure if you have to comment the old
LogFormat ... combined
but commenting this out will keep your config clear.

you can test it by # httpd -t

Reflection

10:07 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



Thanks lemat, I think I get it now. This is what I should have?:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" \"%{cookie}i\"" combined
CustomLog logs/access.log combined

Is this correct?

Thanks for your help

lemat

10:11 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



I'm not sure about the \"%{cookie}i\" part but it seems fine to me.

Reflection

10:15 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



Thanks, the cookie part is from what my log analysis software suggests so... :)