AnsweredAssumed Answered

Audit Filters

Question asked by anusk on Feb 1, 2012
Hi all,

I have a problem with the audit in Alfresco.
I'm trying to build an application to audit the getReader event but only with the content that have a specific property value. For this I build a custom DataExtractor that retrieve the node property value.

I achieve to audit the getReader event, but when I tried to activate the audit filter, nothing happens, all content is audited.

this is my audit application:

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

         <!–
        audit.filter.document.read.no-error.confidencial=true
        –>

        <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="aspectConfidential" registeredName="auditModel.extractor.confidential"/>
            </DataExtractors>

            <DataGenerators>
               <DataGenerator name="personFullName" registeredName="auditModel.generator.personFullName"/>
               <DataGenerator name="currentUser" registeredName="auditModel.generator.user"/>
               <DataGenerator name="systemTime" registeredName="auditModel.generator.time"/>
            </DataGenerators>

            <PathMappings>
            
                <PathMap source="/alfresco-api/post/ContentService/getReader" target="/document/read"/>
            </PathMappings>

            <Application name="document" key="document">          
                <AuditPath key="read">
               <AuditPath key="no-error">
                        <RecordValue key="confidential" dataExtractor="aspectConfidential" dataSource="/document/read/args/nodeRef" />
                        <GenerateValue key="user" dataGenerator="currentUser"/>
               </AuditPath>
                </AuditPath>
            </Application>
    </Audit>

This is the audit log:
11:13:29,468 DEBUG [org.alfresco.repo.audit.inbound] 
Inbound audit values:
   /alfresco-api/post/ContentService/getReader/no-error=null
   /alfresco-api/post/ContentService/getReader/args/nodeRef=workspace://SpacesStore/83904c65-4914-41ec-9361-9f48898243c7
   /alfresco-api/post/ContentService/getReader/result=ContentAccessor[ contentUrl=store://2012/1/30/11/56/f3d350cd-ddba-46f3-a9c2-7fad6701714b.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.document, size=21031, encoding=UTF-8, locale=es_ES]
   /alfresco-api/post/ContentService/getReader/args/propertyQName={http://www.alfresco.org/model/content/1.0}content
11:13:29,468 DEBUG [org.alfresco.repo.audit.model.AuditApplication] Looked up data generators:
   Paths:  [/document/read/args/nodeRef, /document/read/no-error, /document/read/result, /document/read/args/propertyQName]
   Found: {/document/read/no-error/user=org.alfresco.repo.audit.generator.AuthenticatedUserDataGenerator@124cf71}
11:13:29,468 DEBUG [org.alfresco.repo.audit.model.AuditApplication] Looked up data extractors:
   Found: [org.alfresco.repo.audit.model.AuditApplication$DataExtractorDefinition@3b4fc9]
11:13:29,468 DEBUG [org.alfresco.repo.audit.AuditComponentImpl]
Extracted audit data:
   Application:    AuditApplication[ name=document, id=2, disabledPathsId=2]
   Values:        
      /document/read/args/nodeRef=workspace://SpacesStore/83904c65-4914-41ec-9361-9f48898243c7
      /document/read/no-error=null
      /document/read/result=ContentAccessor[ contentUrl=store://2012/1/30/11/56/f3d350cd-ddba-46f3-a9c2-7fad6701714b.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.document, size=21031, encoding=UTF-8, locale=es_ES]
      /document/read/args/propertyQName={http://www.alfresco.org/model/content/1.0}content

   New Data:
      /document/read/no-error/confidential=false

11:13:29,484 DEBUG [org.alfresco.repo.audit.AuditComponentImpl]
New audit entry:
   Application ID: 2
   Entry ID:       562
   Values:        
      /document/read/args/nodeRef=workspace://SpacesStore/83904c65-4914-41ec-9361-9f48898243c7
      /document/read/no-error=null
      /document/read/result=ContentAccessor[ contentUrl=store://2012/1/30/11/56/f3d350cd-ddba-46f3-a9c2-7fad6701714b.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.document, size=21031, encoding=UTF-8, locale=es_ES]
      /document/read/args/propertyQName={http://www.alfresco.org/model/content/1.0}content

   Audit Data:
      /document/read/no-error/confidential=false
      /document/read/no-error/user=test_1

11:13:29,546 DEBUG [org.alfresco.repo.audit.AuditMethodInterceptor] Audited after invocation:
   Values: {/document/read/no-error/confidential=false, /document/read/no-error/user=test_1}

I tried with these properties inside alfresco-global.properties

audit.filter.alfresco-api.post.ContentService.getReader.no-error.confidential=true
audit.filter.document.read.no-error.confidencial=true

But it didn't work.

Debugging I found it only check these properties

audit.filter.alfresco-api.post.ContentService.getReader.no-error
audit.filter.alfresco-api.post.ContentService.getReader.args.nodeRef
audit.filter.alfresco-api.post.ContentService.getReader.result
audit.filter.alfresco-api.post.ContentService.getReader.args.propertyQName


Is it possible to achieve this behavior?
What I'm doing wrong?


Thanks in advanced,
Ana

Outcomes