Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Apache logs: Am I nuts or is this how it's supposed to be?

Apache logs: Am I nuts or is this how it's supposed to be?
Thread Tools
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
May 7, 2003, 07:35 AM
 
Hi all,

I'm using a Combined format log for Apache. Everytime I get a hit, it appears twice! Is this on purpose? Or is this a dumb error?

Example:
218.168.206.23 - - [07/May/2003:04:55:09 -0400] "GET /Mansa/Public/AboutMyMac/screenshot.php HTTP/1.0" 200 714577 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/73 (KHTML, like Gecko) Safari/73"
218.168.206.23 - - [07/May/2003:04:55:09 -0400] "GET /Mansa/Public/AboutMyMac/screenshot.php HTTP/1.0" 200 714577 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/73 (KHTML, like Gecko) Safari/73"
Every line in the log is doubled like this. What could cause this?

Relevant lines from httpd.conf:
Code:
# ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog "/private/var/log/httpd/error_log" # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn # # 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 # # 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 "/private/var/log/httpd/access_log" combined TransferLog "|rotatelogs /var/log/httpd/access_log 86400" #
Anyone?
(Last edited by Mithras; May 7, 2003 at 07:44 AM. )
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
May 7, 2003, 08:20 AM
 
Interesting...

Did you try to see if a simple plain vanilla .html file... when accessed... produces the same double log? For some reason I suspect it is the html code that you use for your site. Why? Because I have the exact same section in my httpd.conf file and I don't get double logs.

Are you running any virtual hosts?
-DU-...etc...
     
Mithras  (op)
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
May 7, 2003, 08:49 AM
 
Everything is doubled -- everything.

127.0.0.1 - - [07/May/2003:09:47:44 -0400] "GET /test.html HTTP/1.1" 200 68 "-" "Links (0.98; Unix; 117x47)"
127.0.0.1 - - [07/May/2003:09:47:44 -0400] "GET /test.html HTTP/1.1" 200 68 "-" "Links (0.98; Unix; 117x47)"
127.0.0.1 - - [07/May/2003:09:49:11 -0400] "GET /PoweredByMacOSX.gif HTTP/1.1" 200 3726 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/73 (KHTML, like Gecko) Safari/73"
127.0.0.1 - - [07/May/2003:09:49:11 -0400] "GET /PoweredByMacOSX.gif HTTP/1.1" 200 3726 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/73 (KHTML, like Gecko) Safari/73"
It's really strange!
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
May 7, 2003, 09:20 AM
 
Originally posted by Mithras:
Everything is doubled -- everything.
It's really strange!
OK.... hmmm... do a search through the httpd.conf file and look for more than one CustomLog directives in your config file. Is there more than one?
-DU-...etc...
     
Mithras  (op)
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
May 7, 2003, 09:56 AM
 
Sorry I'm such a dolt. I should go through this very systematically. But until I do so:

[mithras@localhost: mithras] grep Log /etc/httpd/httpd.conf
# HostnameLookups: Log the names of clients or just their IP addresses
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
ErrorLog "/private/var/log/httpd/error_log"
# LogLevel: Control the number of messages logged to the error_log.
LogLevel warn
# 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
# The location and format of the access logfile (Common Logfile Format).
CustomLog "/private/var/log/httpd/access_log" combined
#CustomLog "/private/var/log/httpd/referer_log" referer
#CustomLog "/private/var/log/httpd/agent_log" agent
# (Combined Logfile Format) you can use the following directive.
#CustomLog "/private/var/log/httpd/access_log" combined
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
So that's a negative. Hmmm.
I'll try going to the stock httpd.conf and compare line-by-line.
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
May 7, 2003, 10:00 AM
 
Originally posted by Mithras:
Sorry I'm such a dolt. I should go through this very systematically. But until I do so:
So that's a negative. Hmmm.
I'll try going to the stock httpd.conf and compare line-by-line.
You did a grep for "Log"... also do a grep for "log".

You can also do a diff on the two files:

diff httpd.conf old.httpd.conf

-DU-...etc...
-DU-...etc...
     
Dedicated MacNNer
Join Date: Dec 2002
Location: someplace
Status: Offline
Reply With Quote
May 7, 2003, 10:47 AM
 
grep -i is case insensitive.
*wink*
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
May 7, 2003, 11:58 AM
 
Originally posted by Mithras:
I'm using a Combined format log for Apache. Everytime I get a hit, it appears twice! Is this on purpose? Or is this a dumb error?

Every line in the log is doubled like this. What could cause this?
you don't need to use both CustomLog *and* TransferLog.

comment out the TransferLog line, and the duplicates should no longer be recorded...

(fyi, you can create as many log files as you want with apache... just keep adding more Transfer/CustomLog directives. you got doubled output because you pointed both directives at the /same/ file)
     
Mithras  (op)
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
May 7, 2003, 02:57 PM
 
Thanks everyone, I figured it out.

Turns out I had an extraneous httpd.conf that had crept into /etc/httpd/users/. That conf file's duplicate Log directives were causing the problem.

rkt, the TransferLog directive just does the rotation so logs don't get too big -- it certainly doesn't cause log doubling, because only the CustomLog directive actually tells apache which type of log to write.

It's disturbingly powerful yet hidden, that /users/ directory. Especially when I had turned off echoing which /users/ directives were being processed at startup...
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
May 9, 2003, 01:29 PM
 
Originally posted by Mithras:
rkt, the TransferLog directive just does the rotation so logs don't get too big -- it certainly doesn't cause log doubling, because only the CustomLog directive actually tells apache which type of log to write.
hmm, okay. that begs the question why use a TransferLog directive at all?

ie, just this instead:
CustomLog "| rotatelogs /var/log/httpd/access_log 86400" combined

from apache 1.3 docs:
"This directive has exactly the same arguments and effect as the CustomLog directive, with the exception that it does not allow the log format to be specified explicitly or for conditional logging of requests."
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:08 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2