AnsweredAssumed Answered

Issue with audit 3.4

Question asked by andersonm on Aug 25, 2011
Latest reply on Sep 7, 2011 by jneeve
Hi all,

Excuse me for my English.

I'm trying to use the new auditing 3.4. I want to persist the audit always that an user consult a document.
I'm able to do this, but not all consultations, only the first consult in each document. E.g., an user creates a document and download it, then it is audited, but if either the same or another user download the same document again, it isn't audited.

So far, I did this:

1  Enabled the audit in the alfresco-global.properties:

# Enable audit in general
audit.enabled=true

# Enable the alfresco-access audit application
audit.alfresco-access.enabled=true

# Enable the auditing of sub-actions. Normally disabled as these values are
# not normally needed by audit configurations, but may be useful to
# developers
audit.alfresco-access.sub-actions.enabled=true

2 Created a file alfresco-audit-document.xml, placed it in <TOMCAT_HOME>/shared/classes/alfresco/extension/audit, and populated it with the follow code:

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

    <!– Node Functions –>

    <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="nodeName" registeredName="auditModel.extractor.nodeName"/>
      <DataExtractor name="nodeType" registeredName="auditModel.extractor.nodeType"/>
        </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="AuditDocument" key="document">          
            <AuditPath key="read">
                <AuditPath key="no-error">
                    <RecordValue key="document" dataExtractor="nodeName" dataSource="/document/read/args/nodeRef"/>
                    <GenerateValue key="user" dataGenerator="personFullName"/>
                </AuditPath>
                <AuditPath key="error">
                    <RecordValue key="document" dataExtractor="nodeName" dataSource="/document/read/args/nodeRef"/>
                    <GenerateValue key="user" dataGenerator="personFullName"/>
                </AuditPath>
            </AuditPath>
        </Application>
</Audit>


With this, I use the command "curl -u admin:admin "http://localhost:8080/alfresco/service/api/audit/query/AuditDocument?verbose=true"" and get a result like this:

{
         "id":2605,
         "application":AuditDocument,
         "user":admin,
         "time":"2011-08-24T12:18:58.284-03:00",
         "values":
         {
                     "\/document\/read\/no-error\/document":"111001-ADD-001-A00.js"
                     ,"\/document\/read\/no-error\/user":"Administrator"
         }
        
      },

It's ok, but have the problem described above.

I'm using alfresco commmunity 3.4.

Hope I could be clear.

Best regards.

Outcomes