[ZODB-Dev] ZODB transaction audit trail suggestions

Jim Fulton jim@zope.com
Thu, 01 Aug 2002 08:30:43 -0400


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.


> 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