[ZODB-Dev] ZODB transaction audit trail suggestions

Tim Hoffman timhoffman@cams.wa.gov.au
02 Aug 2002 11:06:49 +0800


HI Jim


On Thu, 2002-08-01 at 20:30, Jim Fulton wrote:
> Tim Hoffman wrote:
> > Hi
> > 
> > I need to provide an audit trail for every change to my zope web sites
> > and am considering a couple of approaches.
> > 
> > I need to track date time stamp of change, the object changed and what
> > was changed (i.e. the whole object after the changes or the delta from
> > the original).  (change being add/update/delete) 
> 
> 
> It's very possible that you would be better off doing this at the application
> level. You would have greater control. For example, ZODB doesn't track deltas.
> It's possible some ZODB changes wouldn't be interesting.
> 

So do you think I would be better off putting some logging hooks into
the ObjectManager class ?

Thanks for the advice.

Rgds

Tim



> 
> > Has anyone done anything similiar that I could leverage off, if not I
> > suppose I have a number of choices for approaching this, 
> > 
> > 1. grab the hi-level commits in ZODB that are successful and write them
> > to a transaction log. my guess is a monkey patch on BaseStorage
> > tpc_finish 
> > 
> > 2. intercept the store request in ZEO, and write out a transaction log
> > entry there.
> > 
> > 3. have a seperate process reading from the end of Data.fs (a bit like
> > fsrecover.py ) writing out each transaction as it is writen to Data.fs
> > 
> > I much prefer 1 or 2, as that keeps it abstract enough that I can have
> > any storage. 
> > 
> > I prefer 1 over 2, as I may not always use ZEO.
> 
> Most storages already keep transaction logs.  You could get at this through the undo
> API, althouigh that is not exactly what you want. You could write a tool that
> extracts this from the Data.fs pretty easily and some tools like this exist
> already, especially tranalizer.
> 
> Jim
> 
> -- 
> Jim Fulton           mailto:jim@zope.com       Python Powered!
> CTO                  (888) 344-4332            http://www.python.org
> Zope Corporation     http://www.zope.com       http://www.zope.org