Re: [Zope3-dev] Additional address(es) in access.log

2006-02-03 Thread Stephan Richter
On Tuesday 31 January 2006 07:06, Jim Washington wrote:
> Please pardon if the patch is not-quite-right.  I did not read the
> directions.

Jim, could you make this a issue report in the Twisted collector and assign it 
to James Knight?

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Additional address(es) in access.log

2006-01-31 Thread Jim Washington
I have attached a diff against zope.twisted.web2.log that puts 
additional ip address(es) in access.log.


With this patch, the ip address section in the log may become a list of 
addresses delimited with '>'. 

It uses the 'x-forwarded-for' headers, so the info may not be trustable, 
but it is much more informative than '192.168.1.1' for every address if 
you run z3 behind a proxy like pound.


Please pardon if the patch is not-quite-right.  I did not read the 
directions.


-Jim Washington

*** log.py	Sat Jan 28 19:20:33 2006
--- /usr/lib/zope-3.2.0/lib/python/twisted/web2/log.py	Sat Jan 28 20:46:34 2006
***
*** 148,158 
  request.method,
  request.uri,
  '.'.join([str(x) for x in request.clientproto]))
! 
  self.logMessage(
  '%s - %s [%s] "%s" %s %d "%s" "%s"' %(
! request.chanRequest.getRemoteHost().host,
  # XXX: Where to get user from?
  "-",
  self.logDateString(
  response.headers.getHeader('date', 0)),
--- 148,165 
  request.method,
  request.uri,
  '.'.join([str(x) for x in request.clientproto]))
! proxyAddresses = request.headers.getRawHeaders('x-forwarded-for',None)
! singleHost = request.chanRequest.getRemoteHost().host
! if proxyAddresses:
! proxyAddresses.append(singleHost)
! logAddress =  '>'.join(proxyAddresses)
! else:
! logAddress = singleHost
  self.logMessage(
  '%s - %s [%s] "%s" %s %d "%s" "%s"' %(
! #request.chanRequest.getRemoteHost().host,
  # XXX: Where to get user from?
+ logAddress,
  "-",
  self.logDateString(
  response.headers.getHeader('date', 0)),
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com