You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hans Vallden <ha...@vallden.com> on 2004/03/02 10:15:51 UTC

[users@httpd] REPOST: IPs missing from log files

***
I'm reposting this message because I haven't found any solution (or 
even suggestion) from any public forum nor have I been able to solve 
the problem myself despite racking my brain many times over. Maybe 
I'll get lucky this time... :)
***

I have run across a mind boggling problem. I run fairly standard conf 
Apache 1.3.27 on Mac OS X Server 10.2.8. I have about 20 Apache 
virtual domains and 5 unique IP addresses in use. After adding the 
latest three vhosts I noticed a strange phenomena with the log files. 
For some reason these three vhost log files do not get the visitor's 
IP address recorded, just a 'dash'. I have no clue whatsoever as to 
why this happens. The relevant /etc/httpd/httpd_macosxserver.conf 
lines look perfectly alike. I have tried fiddling with pretty much 
everything imaginable to see what's causing the problem.

Let me point out that _everything else_ Apache related works flawlessly.

For those of you not familiar with the OS X Server oddities, let me 
explain a couple OS specific things. The commented lines are 
generated by the Server Admin application used to manage vhost 
specific settings. The two CustomLog lines are explained by how the 
Server Admin app is bypassed according to Apple's instructions (I 
want a slightly non-standard log format the Server Admin app isn't 
able to create). The 16080 port is used due to the internal 
performance cache. Even though it's not on for any of my domains, 
some still seem to have that port in settings (don't ask me about the 
logic behind that, I just don't know).

I have attached an example of both a working vhost config and a 
non-working one. I really really really hope someone can point out 
the cause of the problem and a remedy of course. :)

***THIS ONE WORKS***

#<RAdmin 102>
NameVirtualHost XXX.XX.XX.28:16080
Listen XXX.XX.XX.28:16080
<VirtualHost XXX.XX.XX.28:16080>
ServerName www.domain1.com
#WebPerfCacheEnable On
#SiteAutomaticallyDisabled Off
ServerAdmin webmaster@domain1.com
DocumentRoot "/Library/WebServer/Documents/www.domain1.com"
DirectoryIndex index.html index.php
CustomLog "/dev/null" "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b"
CustomLog "/private/var/log/httpd/domain1.com/access_log" 
"%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-agent}i\""
ErrorLog "/private/var/log/httpd/domain1.com/error_log"
<IfModule mod_ssl.c>
SSLEngine Off
SSLLog "/private/var/log/httpd/ssl_engine_log"
#SSLCertificateChainFile "/private/etc/httpd/ssl.crt/ca.crt102"
#SSLCertificateFile "/private/etc/httpd/ssl.crt/server.crt102"
#SSLCertificateKeyFile "/private/etc/httpd/ssl.key/server.key102"
SSLCipherSuite "RSA:-HIGH:-MEDIUM:-LOW:+EXP"
#SSLPassPhrase www.domain1.com:16080 ""
</IfModule>
<IfModule mod_dav.c>
DAVLockDB "/private/var/run/davlocks/.davlock102"
DAVMinTimeout 600
</IfModule>
<Directory "/Library/WebServer/Documents/www.domain1.com">
Options All +MultiViews -ExecCGI -Indexes
AllowOverride All
<IfModule mod_dav.c>
DAV Off
</IfModule>
</Directory>
</VirtualHost>
#</RAdmin>


***THIS ONE DOESN'T WORK***

#<RAdmin 142>
NameVirtualHost XXX.XX.XX.30:80
Listen XXX.XX.XX.30:80
<VirtualHost XXX.XX.XX.30:80>
ServerName www.domain2.com
#WebPerfCacheEnable Off
#SiteAutomaticallyDisabled Off
ServerAdmin webmaster@domain2.com
DocumentRoot "/Library/WebServer/shared/acmeshop/modules/user"
DirectoryIndex index.html index.php
CustomLog "/dev/null" "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b"
CustomLog "/private/var/log/httpd/domain2.com/access_log" 
"%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-agent}i\""
ErrorLog "/private/var/log/httpd/domain2.com/error_log"
<IfModule mod_ssl.c>
SSLEngine Off
SSLLog "/private/var/log/httpd/ssl_engine_log"
#SSLCertificateChainFile "/private/etc/httpd/ssl.crt/ca.crt142"
#SSLCertificateFile "/private/etc/httpd/ssl.crt/server.crt142"
#SSLCertificateKeyFile "/private/etc/httpd/ssl.key/server.key142"
SSLCipherSuite "RSA:-HIGH:-MEDIUM:-LOW:+EXP"
#SSLPassPhrase www.domain2.com:80 ""
</IfModule>
<IfModule mod_dav.c>
DAVLockDB "/private/var/run/davlocks/.davlock142"
DAVMinTimeout 600
</IfModule>
<Directory "/Library/WebServer/shared/acmeshop/modules/user">
Options All +MultiViews -ExecCGI -Indexes
AllowOverride All
include /Library/WebServer/Documents/www.domain2.com/php.conf
<IfModule mod_dav.c>
DAV Off
</IfModule>
</Directory>
</VirtualHost>
#</RAdmin>

-- 

--
Hans Vallden
hans@vallden.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] REPOST: IPs missing from log files

Posted by Hans Vallden <ha...@vallden.com>.
>It sounds like a config issue with whatever's doing the reverse
>proxying.  If the header isn't there then Apache can't log it.  I know
>absolutely nothing about OS X, so I'd suggest you try the list for
>whatever's doing the proxying.

After a few quick tests I think you may be right. Thanks!
-- 

--
Hans Vallden                    
hans@vallden.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] REPOST: IPs missing from log files

Posted by Brian Dessent <br...@dessent.net>.
Hans Vallden wrote:

> >Why in the world are you using "%{PC-Remote-Addr}i" and not "%h" for the
> >address?  I have never heard of the header "PC-Remote-Addr", it must be
> >some custom OS X thing that one of your client applications sends, but
> >not always.
> 
> Because OS X Server's Apache works through an internal performance
> cache. Hence, using the %h setting results in only the local host's
> IP address being logged. I haven't heard of another way around this.
> I'm glad to hear if there is one, though...

Well then this is not an Apache issue.  Whatever software is acting as
the reverse proxy is omitting the "PC-Remote-Addr:" header for some
requests.

> >That would explain why it's sometimes blank.  The "%{}i"
> >notion only logs headers that the client sends, and so by using it
> >you're entirely at the mercy of what headers your client software
> >decides to send.
> 
> Maybe so, but I don't see immediate logic in this explanation because
> the "%{PC-Remote-Addr}i" log setting is working perfectly fine in
> about 18 of the 20 domains I host. Why would it not work for the two
> in question?

It sounds like a config issue with whatever's doing the reverse
proxying.  If the header isn't there then Apache can't log it.  I know
absolutely nothing about OS X, so I'd suggest you try the list for
whatever's doing the proxying.

Brian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] REPOST: IPs missing from log files

Posted by Hans Vallden <ha...@vallden.com>.
>Hans Vallden wrote:
>
>>  virtual domains and 5 unique IP addresses in use. After adding the
>>  latest three vhosts I noticed a strange phenomena with the log files.
>>  For some reason these three vhost log files do not get the visitor's
>>  IP address recorded, just a 'dash'. I have no clue whatsoever as to
>>  why this happens. The relevant /etc/httpd/httpd_macosxserver.conf
>>  ...
>>  CustomLog "/private/var/log/httpd/domain1.com/access_log"
>>  "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
>>  \"%{User-agent}i\""
>>  ...
>>  CustomLog "/private/var/log/httpd/domain2.com/access_log"
>>  "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
>>  \"%{User-agent}i\""
>
>Why in the world are you using "%{PC-Remote-Addr}i" and not "%h" for the
>address?  I have never heard of the header "PC-Remote-Addr", it must be
>some custom OS X thing that one of your client applications sends, but
>not always.

Because OS X Server's Apache works through an internal performance 
cache. Hence, using the %h setting results in only the local host's 
IP address being logged. I haven't heard of another way around this. 
I'm glad to hear if there is one, though...

>That would explain why it's sometimes blank.  The "%{}i"
>notion only logs headers that the client sends, and so by using it
>you're entirely at the mercy of what headers your client software
>decides to send.

Maybe so, but I don't see immediate logic in this explanation because 
the "%{PC-Remote-Addr}i" log setting is working perfectly fine in 
about 18 of the 20 domains I host. Why would it not work for the two 
in question?

-- 

--
Hans Vallden                    
hans@vallden.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] REPOST: IPs missing from log files

Posted by Brian Dessent <br...@dessent.net>.
Hans Vallden wrote:

> virtual domains and 5 unique IP addresses in use. After adding the
> latest three vhosts I noticed a strange phenomena with the log files.
> For some reason these three vhost log files do not get the visitor's
> IP address recorded, just a 'dash'. I have no clue whatsoever as to
> why this happens. The relevant /etc/httpd/httpd_macosxserver.conf
> ...
> CustomLog "/private/var/log/httpd/domain1.com/access_log"
> "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
> \"%{User-agent}i\""
> ...
> CustomLog "/private/var/log/httpd/domain2.com/access_log"
> "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
> \"%{User-agent}i\""

Why in the world are you using "%{PC-Remote-Addr}i" and not "%h" for the
address?  I have never heard of the header "PC-Remote-Addr", it must be
some custom OS X thing that one of your client applications sends, but
not always.  That would explain why it's sometimes blank.  The "%{}i"
notion only logs headers that the client sends, and so by using it
you're entirely at the mercy of what headers your client software
decides to send.

Brian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org