<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mattdorn.com &#187; zope</title>
	<atom:link href="http://www.mattdorn.com/content/tag/zope/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattdorn.com</link>
	<description>Generously funded by Matt Dorn</description>
	<lastBuildDate>Sun, 07 Feb 2010 00:07:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting AWStats to show Plone-authenticated users</title>
		<link>http://www.mattdorn.com/content/getting-awstats-to-show-plone-authenticated-users/</link>
		<comments>http://www.mattdorn.com/content/getting-awstats-to-show-plone-authenticated-users/#comments</comments>
		<pubDate>Sun, 15 Oct 2006 19:12:36 +0000</pubDate>
		<dc:creator>mdorn</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://67.207.132.145/wordpress/?p=36</guid>
		<description><![CDATA[


I&#8217;m using AWStats to track usage on a Plone site that&#8217;s essentially a portal for collaborative document translation.  That means that most users of the site need to login to do anything useful, and I want to see who&#8217;s logging in along with the rest of the stats on my site.
For hosting the site, [...]]]></description>
			<content:encoded><![CDATA[
<div class="document">
<!-- -*- mode: rst -*- -->
<p>I&#8217;m using AWStats to track usage on a Plone site that&#8217;s essentially a portal for collaborative document translation.  That means that most users of the site need to login to do anything useful, and I want to see who&#8217;s logging in along with the rest of the stats on my site.</p>
<p>For hosting the site, I&#8217;m using the recommended setup which uses Zope&#8217;s Virtual Host Monser to route requests and responses between Apache and the Zope application server appropriately.  I.e., I include the following two key lines in my Apache directive:</p>
<pre class="literal-block">
RewriteEngine On
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/MyApp/VirtualHostRoot/$1 [NC,P,L]
</pre>
<p>Since I&#8217;m going thru Apache, I can record requests in log files as with any other site.  Unfortunately, Zope/Plone does not pass information about the users who authenticate via its own system to the HTTP headers.  Taking a cue from <a class="reference" href="http://mail.zope.org/pipermail/zope/2006-May/166316.html">this thread</a>, I came up with the following solution.  It&#8217;s tested on Plone 2.1.3, but probably won&#8217;t work on Plone 2.5, given the latter&#8217;s use of Pluggable Authentication Service.</p>
<p>First, I found a place in the Plone page rendering mechanism that gets executed on each page view.  I suppose the place that I chose was somewhat arbitrary, but in the &quot;authenticate&quot; method of the file <tt class="docutils literal"><span class="pre">GroupUserFolder/GroupUserFolder.py</span></tt>, I set a header called <tt class="docutils literal"><span class="pre">X-PloneUser</span></tt>, as shown in the following patch, available for your use:</p>
<pre class="literal-block">
1020,1022d1019
&lt;         # PATCH FOR TRACKING AUTH USER IN APACHE LOGS --mdorn:
&lt;         if name is not None:
&lt;             request.RESPONSE.setHeader('X-PloneUser', name)
</pre>
<p>In my Apache configuration, I had to change <tt class="docutils literal"><span class="pre">LogFormat</span></tt> from &quot;combined&quot; to something more specific, and reference the label in the <tt class="docutils literal"><span class="pre">CustomLog</span></tt>:</p>
<pre class="literal-block">
LogFormat &quot;%h %l %{X-Ploneuser}o %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-agent}i\&quot;&quot; plone
CustomLog &quot;|/usr/local/sbin/cronolog /home/httpd/MYDOMAIN/logs/%m-%Y/access_log&quot; plone
</pre>
<p>To see authenticated users in your AWStats configuration file, you&#8217;ll need to change the default value for that setting:</p>
<pre class="literal-block">
ShowAuthenticatedUsers=1
</pre>
<p>That&#8217;s it.  Next time AWStats processes your logs, assuming you had visits from authenticated users, you&#8217;ll now see them in the appropriate location on your AWStats report.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattdorn.com/content/getting-awstats-to-show-plone-authenticated-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
