AnsweredAssumed Answered

Help with new Audit configuration

Question asked by billerby on Jan 18, 2011
Ok, after a recent upgrade to 3.4.c I've been struggling with the new Auditing mechanism.

At first we want to track new nodes, deleted nodes and modified properties on nodes.

I have come up with the following configuration to begin with:


<?xml version='1.0' encoding='UTF-8'?>

<Audit xmlns="http://www.alfresco.org/repo/audit/model/3.2"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd">

   <DataExtractors>
      <DataExtractor name="simpleValue" registeredName="auditModel.extractor.simpleValue" />
      <DataExtractor name="nullValue" registeredName="auditModel.extractor.nullValue" />
      <DataExtractor name="nodeNameValue" registeredName="auditModel.extractor.nodeName" />
      <DataExtractor name="nodeTypeValue" registeredName="auditModel.extractor.nodeType" />
   </DataExtractors>

   <PathMappings>
      <PathMap source="/alfresco-api" target="/spirit" />
   </PathMappings>

   <Application name="Spirit" key="spirit">
      <AuditPath key="pre">
         <AuditPath key="NodeService">
            <AuditPath key="deleteNode">
               <AuditPath key="args">
                  <AuditPath key="nodeRef">
                     <RecordValue key="value" dataExtractor="nodeNameValue" />
                  </AuditPath>
               </AuditPath>
            </AuditPath>
            <AuditPath key="addProperties">
               <AuditPath key="args">
                  <AuditPath key="nodeRef">
                     <RecordValue key="value" dataExtractor="nodeNameValue" />
                  </AuditPath>
                  <AuditPath key="properties">
                     <RecordValue key="value" dataExtractor="simpleValue" />
                  </AuditPath>
               </AuditPath>
            </AuditPath>
         </AuditPath>
      </AuditPath>
      <AuditPath key="post">
         <AuditPath key="NodeService">
            <AuditPath key="createNode">
               <AuditPath key="result">
                  <RecordValue key="value" dataExtractor="nodeNameValue" />
               </AuditPath>
            </AuditPath>
            <AuditPath key="addProperties">
               <AuditPath key="args">
                  <AuditPath key="nodeRef">
                     <RecordValue key="value" dataExtractor="nodeNameValue" />
                  </AuditPath>
                  <AuditPath key="properties">
                     <RecordValue key="value" dataExtractor="simpleValue" />
                  </AuditPath>
               </AuditPath>
            </AuditPath>
         </AuditPath>
      </AuditPath>
   </Application>
</Audit>

This configuration works for all methods except the "createNode". My aim here was to only log the name of the newly created node, however nothing gets audited. Here is a snippet from the log-file:


09:35:31,219 DEBUG [org.alfresco.repo.audit.AuditComponentImpl]
Extracted audit data:
   Application:    AuditApplication[ name=Spirit, id=9, disabledPathsId=82]
   Values:        
      /spirit/post/NodeService/createNode/args/assocTypeQName={http://www.alfresco.org/model/content/1.0}contains
      /spirit/post/NodeService/createNode/args/properties={{http://www.alfresco.org/model/application/1.0}editInline=true, {http://www.alfresco.org/model/content/1.0}name=BasicExample.java, {http://www.alfresco.org/model/content/1.0}description=null, {http://www.alfresco.org/model/content/1.0}title=BasicExample.java, {http://www.alfresco.org/model/content/1.0}author=null}
      /spirit/post/NodeService/createNode/result=workspace://SpacesStore/346d5770-c93e-4cd0-bb54-572a1a4e424d|workspace://SpacesStore/b2736273-9090-409b-b7cb-ca1dfc98081d|{http://www.alfresco.org/model/content/1.0}contains|{http://www.alfresco.org/model/content/1.0}BasicExample.java|true|-1
      /spirit/post/NodeService/createNode/no-error=null
      /spirit/post/NodeService/createNode/args/parentRef=workspace://SpacesStore/346d5770-c93e-4cd0-bb54-572a1a4e424d
      /spirit/post/NodeService/createNode/args/assocQName={http://www.alfresco.org/model/content/1.0}BasicExample.java
      /spirit/post/NodeService/createNode/args/nodeTypeQName={http://www.acando.com/model/1.0}bild

   New Data:

09:35:31,219 DEBUG [org.alfresco.repo.audit.AuditComponentImpl]
Nothing audited:
   Application ID: 9
   Entry ID:       null
   Values:        
      /spirit/post/NodeService/createNode/args/assocTypeQName={http://www.alfresco.org/model/content/1.0}contains
      /spirit/post/NodeService/createNode/args/properties={{http://www.alfresco.org/model/application/1.0}editInline=true, {http://www.alfresco.org/model/content/1.0}name=BasicExample.java, {http://www.alfresco.org/model/content/1.0}description=null, {http://www.alfresco.org/model/content/1.0}title=BasicExample.java, {http://www.alfresco.org/model/content/1.0}author=null}
      /spirit/post/NodeService/createNode/result=workspace://SpacesStore/346d5770-c93e-4cd0-bb54-572a1a4e424d|workspace://SpacesStore/b2736273-9090-409b-b7cb-ca1dfc98081d|{http://www.alfresco.org/model/content/1.0}contains|{http://www.alfresco.org/model/content/1.0}BasicExample.java|true|-1
      /spirit/post/NodeService/createNode/no-error=null
      /spirit/post/NodeService/createNode/args/parentRef=workspace://SpacesStore/346d5770-c93e-4cd0-bb54-572a1a4e424d
      /spirit/post/NodeService/createNode/args/assocQName={http://www.alfresco.org/model/content/1.0}BasicExample.java
      /spirit/post/NodeService/createNode/args/nodeTypeQName={http://www.acando.com/model/1.0}bild

Any help on this would be appreciated.

Thanks
/Erik

Outcomes