Dear list,

I've been going through the list archives looking for tips on logging (getting sensible statistics from my log files). At the moment I have the setup recommended by most posts, namely multiple Apache virtual hosts that proxies requests to a single Zope instance.

I would like to know how I can get Apache to log the current Zope user.
Here's an example from my Apache access_log: - - [02/May/2006:15:32:18 +0200] "GET / HTTP/1.1" 200 35721

Which results in this entry from my Z2.log: - adp [02/May/2006:15:32:21 +0200] "GET /VirtualHostBase/http/ HTTP/1.1" 200 36054 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv: Gecko/20060308 Firefox/"

The current user is logged by Zope, but not by Apache.
Is there a way to make Apache aware of who is logged in through Zope?
I'm also trying to do the same thing. I want either to modify the zope
log in order to show the real user IP and replace the referrer by the
one the user typed in the browser (without everything between
VirtualHostBase and VirtualHostRoot) or just return the authenticated
user to apache.

I read the answer from Dieter and unfortunately I'm not authenticating
from Apache. So, I went for the approach indicated by Chris Withers
without any success:

> If your Zope auth solution can put a header in the http response, then > you can use a custom apache logging directive to put this in your
> Apache log in place of what it thinks the username is.
I put this on the "log" method of the medusa/ file:

and set my apache access log like this:
CustomLog /home/apache/httpd/logs/access_log combined

The combined log is defined as follows:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

There you see the %l and %u directives, which are the "Remote logname" and the "Remote user".

But apache still doesn't get the zope authenticated user. So, Chris, do you remember what header you set, where, and which method you used?

On the other hand, I also tried to do it the opposite way: modify the zope log in order to show the real ip address and remove every VirtualHost info from the referrer. I achieved the first part by using the following patch:

Then I tried the following in the "log" method of the medusa/ file:

#I tried this as well
if not referer:
    if not referer:
    referer='/' + referer[1]

But it seems that I can't access the 'VIRTUAL_URL_PARTS' key. How can I get this information?

Thanks in advanced,

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to