cancel
Showing results for 
Search instead for 
Did you mean: 

Enable auditing in 3.2?

gronfelt
Champ in-the-making
Champ in-the-making
I've tried to enable auditing in Alfresco 3.2, following the instructions in the wiki, but it doesn't seem to work, no audit trail is created when I download a file for instance.

I've copied the file auditConfig.xml to tomcat/shared/classes/alfresco/extension/ and edited the relevant parts:

<Audit xmlns="http://www.alfresco.org/model/audit/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" enabled="true" auditInternal="false" mode="all">

and

    <Service name="ContentService" mode="none">
        <Method name="getWriter" mode="all"/>
        <Method name="transform" mode="all"/>
        <Method name="getReader" mode="all"/>
    </Service>

Is there anything else that needs to be done in Alfresco 3.2?
14 REPLIES 14

derek
Star Contributor
Star Contributor
Hi,
Turn on DEBUG for the audit model and make sure that the audit mode is as expected:
   log4j.logger.org.alfresco.repo.audit.model=DEBUG

Regards

lees
Champ in-the-making
Champ in-the-making
Got any solution?

It doesn't work for me also.

bertrandf
Champ on-the-rise
Champ on-the-rise
I've got the same problem with 3.2r and the nightly build version.
Maybe due to the patch : patch.db-V3.2-AuditTables (AlfrescoPostCreate-3.2-AuditTables.sql) ?

bertrandf
Champ on-the-rise
Champ on-the-rise
I've enabled audit (in auditConfig.xml, I just changed "enable=true").

I turned DEBUG on for the audit model :

DEBUG [org.alfresco.repo.audit.model.AuditEntry] Audit configuration
DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Audit Mode = ALL
DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Enabled = TRUE

I created/read/updated documents, workflows, … but 'Service' and 'Method' columns aren't populated in the DB.
It's look like I haven't turn audit on.

AuditSurf works with Alfresco 3.2 but not with Alfresco 3.2r and Alfresco 3.2 nightly-build …

Tested on :
Alfresco Community 3.2r (r 2384) schema 3003 / Tomcat 6.0.18 / MySQL 5.1 / JDK 6u12 x32 / Win XP SP2


Anybody got any ideas?
Thanks.

derek
Star Contributor
Star Contributor
Hi,
I'm getting this added to the release notes - apologies for missing it out - but details are here:
http://wiki.alfresco.com/wiki/Audit (See "As of 3.2r")
Regards

bertrandf
Champ on-the-rise
Champ on-the-rise
Thanks Derek, it works fine now Smiley Very Happy
Regards.

lees
Champ in-the-making
Champ in-the-making
it works for me also. It displays the audit details as below

tmp.user     SystemMethodInterceptor     NodeService     getAspects     Oct 21, 2009 10:24:10 AM     OK           workspace://SpacesStore/c6697a21-f7d0-4d6d-834a-39a3b8850b6c                             [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/content/1.0}titled, {http://www.alfresco.org/model/content/1.0}lockable, {http://www.alfresco.org/model/content/1.0}author, {http://www.alfresco.org/model/content/1.0}templatable]           e4aba8e7-49a6-4273-ac05-edcbc27659db

But this is not the property that I am looking for and how can we read this. How can I get the audit information related to a file/folder(like who all are the users updated content, what are files added/deleted etc)?

derek
Star Contributor
Star Contributor
Hi,
The new audit code in 3.2r was designed to store the information in a more searchable and concise form.  It's still early days for the code, so I've not had a chance to detail the configuration on the Wiki.
Take a look at: org.alfresco.repo.audit.AuditComponentTest#testAuditAuthenticationService.  It uses config from classpath:alfresco/audit/alfresco-audit-test.xml like this:


    <PathMappings>
        …
        <PathMap source="/alfresco-api" target="/api-test"/>
    </PathMappings>
….
    <Application name="API Test" key="api-test">
        <AuditPath key="post">
           <AuditPath key="AuthenticationService">
               <AuditPath key="authenticate">
                   <AuditPath key="args">
                       <AuditPath key="userName">
                           <RecordValue key="value" dataExtractor="simpleValue"/>
                       </AuditPath>
                   </AuditPath>
                   <AuditPath key="error">
                            <RecordValue key="value" dataExtractor="simpleValue"/>
                   </AuditPath>
               </AuditPath>
           </AuditPath>
       </AuditPath>
    </Application>
The audit code is now split up into data producers and data consumers.  The config declares which data is to be consumed and persisted for later retrieval.  In the RM use-case, we had to audit data produced by non-API code (RM actions) as well as do things like store the changes to node properties before and after a change to a node.  The RM audit config looks like this:

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

<!– Default Audit Configuration –>

<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="nodeName" registeredName="auditModel.extractor.nodeName"/>
       <DataExtractor name="nodeType" registeredName="auditModel.extractor.nodeType"/>
       <DataExtractor name="userRoles" registeredName="org_alfresco_module_dod5015_userRolesExtractor"/>
       <DataExtractor name="namePath" registeredName="org_alfresco_module_dod5015_namePathExtractor"/>
       <DataExtractor name="nodeRefPath" registeredName="org_alfresco_module_dod5015_nodeRefPathExtractor"/>
       <DataExtractor name="nodeIdentifier" registeredName="org_alfresco_module_dod5015_identifierExtractor"/>
    </DataExtractors>
   
    <DataGenerators>
       <DataGenerator name="personFullName" registeredName="auditModel.generator.personFullName"/>
    </DataGenerators>

    <PathMappings>
        <PathMap source="/DOD5015" target="/DOD5015"/>
        <!– Force the fullName generator to trigger –>
        <PathMap source="/DOD5015/event/node" target="/DOD5015/event/person"/>
        <PathMap source="/alfresco-api/post/AuthenticationService/authenticate" target="/DOD5015/login"/>
    </PathMappings>

    <Application name="DOD5015" key="DOD5015">
        <AuditPath key="event">
            <!– Record user details –>
            <AuditPath key="person">
                <RecordValue key="roles" dataExtractor="userRoles"/>
                <GenerateValue key="fullName" dataGenerator="personFullName"/>
            </AuditPath>
            <!– Record a description of the event –>
            <AuditPath key="name">
                <RecordValue key="value" dataExtractor="simpleValue"/>
            </AuditPath>
            <!– Record the node's details –>
            <AuditPath key="node">
                <RecordValue key="noderef" dataExtractor="simpleValue"/>
                <RecordValue key="name" dataExtractor="nodeName"/>
                <RecordValue key="type" dataExtractor="nodeType"/>
                <RecordValue key="namePath" dataExtractor="namePath"/>
                <RecordValue key="nodeRefPath" dataExtractor="nodeRefPath"/>
                <RecordValue key="identifier" dataExtractor="nodeIdentifier"/>
                <AuditPath key="changes">
                   <AuditPath key="before">
                       <RecordValue key="value" dataExtractor="simpleValue"/>
                   </AuditPath>
                    <AuditPath key="after">
                        <RecordValue key="value" dataExtractor="simpleValue"/>
                    </AuditPath>
                </AuditPath>
            </AuditPath>
            <!–
                RM action parameters
                * Keyed by action name to be more selective
                * Only record the parameters if they are of interest
            –>
            <!– A test action –>
            <AuditPath key="testAction">
                <AuditPath key="parameters">
                    <AuditPath key="testActionParam">
                        <RecordValue key="value" dataExtractor="simpleValue"/>
                    </AuditPath>
                </AuditPath>
            </AuditPath>
        </AuditPath>
        <AuditPath key="login">
            <AuditPath key="args">
                <AuditPath key="userName">
                    <RecordValue key="value" dataExtractor="simpleValue"/>
                </AuditPath>
            </AuditPath>
            <AuditPath key="no-error">
                <GenerateValue key="fullName" dataGenerator="personFullName"/>
            </AuditPath>
            <AuditPath key="error">
                <RecordValue key="value" dataExtractor="nullValue"/>
            </AuditPath>
        </AuditPath>
    </Application>

</Audit>

Additionally, the AuditService now has a fledgeling search API, which I intend to extend as we fill in the extension use-cases (non-DOD5015).

Regards
Derek

cedomir
Champ in-the-making
Champ in-the-making
Hi all,
I still can't make auditing work in 3.2r. What exactly I have to do?

1. Edit ../conf/alfresco/extension/alfresco-global.properties and add
audit.enabled=true
audit.useNewConfig=false

2. Edit in alfresco.war package file WEB-INF/classes/alfresco/auditConfig.xml and change:
<Audit xmlns="http://www.alfresco.org/model/audit/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
enabled="false" auditInternal="false" mode="all">
to
<Audit xmlns="http://www.alfresco.org/model/audit/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
enabled="true" auditInternal="false" mode="all">

Anything else? What I am missing?
Thanks in advance.

Alfresco log is:
14:53:42,337 DEBUG [org.alfresco.repo.audit.model.AuditEntry] Audit configuration
14:53:42,341 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Audit Mode = ALL
14:53:42,343 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Enabled = TRUE
14:53:42,344 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Audit Internal = FALSE
14:53:42,349 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Record Options = Record Options(Filters=FALSE,Path=FALSE,Exception=FALSE,PropertiesBefore=FALSE,PropertiesAfter=FALSE,Args=FALSE,Return=FALSE)
14:53:42,352 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Filter = null
14:53:42,353 DEBUG [org.alfresco.repo.audit.model.AuditEntry] Adding services …
14:53:42,359 DEBUG [org.alfresco.repo.audit.model.AbstractNamedAuditEntry] Name = ServiceRegistry
14:53:42,361 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Audit Mode = NONE
14:53:42,362 DEBUG [org.alfresco.repo.audit.model.AbstractAuditEntry] Enabled = FALSE