[an error occurred while processing this directive]

DirXML eDirectory Change Log Tool
DirXML Cool Solutions Article
by Israel Forst
Reader Rating    from ratings rate this article
View a Printer Friendly Version of this Page Send this page to a friend

Posted on 19 Feb 2002

Israel Forst responded to a reader who asked about the ability to generate a log of changes made to eDirectory objects. His response includes a slick DirXML tool that generates the requested logs and can be customized to do more.

Question Asked:
Do you know how I can simulate generating a changelog in eDirectory?. Am trying to run a LDAP agent which wants only the delta-changes from the directory. The only option I have available is really ugly!

Israel's Answer:
I wrote a simple change log using the DirXML Skeleton Driver and the Advanced Java Classes. This is a rudimentary implementation but it can be modified to do just about anything.

Get the necessary files here: changelog.zip

The output file lists the Date/Time of the event (not the date/time of the event in eDir but rather the date/time that DirXML processes it), the Event Type, the object affected and the objectClass in a tab delimited format.

It looks something like this:

20020120140642 ADD \TREE-A\class\OU1 Organizational Unit
20020120140648 RENAME \TREE-A\class\OU1 to \TREE-A\class\OU2 Organizational Unit
20020120140650 DELETE \TREE-A\class\OU2 Organizational Unit
20020120140656 ADD \TREE-A\class\Group1 Group
20020120140705 MODIFY \TREE-A\class\Group1 Group
20020120140705 MODIFY \TREE-A\class\Group1 Group
20020120140705 MODIFY \TREE-A\class\Group1 Group
20020120140705 MODIFY \TREE-A\class\Group1 Group
20020120140706 MODIFY \TREE-A\class\test User
20020120140706 MODIFY \TREE-A\class\test User
20020120140706 MODIFY \TREE-A\class\test2 User
20020120140706 MODIFY \TREE-A\class\test2 User
20020120140707 MODIFY \TREE-A\class\test5 User
20020120140707 MODIFY \TREE-A\class\test7 User
20020120140730 DELETE \TREE-A\class\Group1 Group
20020120140730 MODIFY \TREE-A\class\test User
20020120140730 MODIFY \TREE-A\class\test2 User
20020120140730 MODIFY \TREE-A\class\test5 User
20020120140730 MODIFY \TREE-A\class\test7 User
20020120141123 RENAME \TREE-A\class\test12 User
20020120141233 MOVE \TREE-A\class\servers\test7 User
20020120141628 MOVE \TREE-A\class\test to \TREE-A\class\servers\test User

This sample driver illustrates a few principles of DirXML. The first component of this driver is the Skeleton Driver Shim which can be downloaded from http://developer.novell.com/ndk/dirxml.htm The skeleton driver implements all of the required interfaces and demonstrates how various driver tasks are done. Its purpose is to ease the development of DirXML drivers. It implements all components of the driver shim except the connection to the remote database. Since we are not really communicating with a remote database, the skeleton driver does not require any changes for us to use it.

Since we are only processing events from eDirectory, we don't need a Publisher Channel. The subscriber channel has one interesting feature and that is the Filter. Just like any channel filter, the Subscriber Filter will determine which objects/attributes will trigger an entry in the log file. If your filter contains only the User class then creating a Group will not trigger an entry in the changelog. Additionally, if only Surname is listed in the filter as attributes of a User, then changing the Given Name will not trigger an entry in the changelog.

The only rule is an Event Transformation Rule linked to the Subscriber Channel. There are two variables that need to be set properly prior to starting the driver.

<xsl:variable name="log-path">c:\temp\</xsl:variable>
<xsl:variable name="log-filename">changelog.txt</xsl:variable>

log-path specifies the directory that the log file will be placed in.
log-filename specifies the name of the file to be used. If this variable is set to "" then the log file name will be auto-generated each month.

The stylesheet also demonstrates how to call external Java functions. The functions we call are included in a custom Java class written by Novell consultant Holger Dopp. The class has two functions, one to write to a log file and one to get the current system time.

Israel Forst - iforst@novell.com
Worldwide Net Solutions Support
Solution Support Lead