Thursday, December 10, 2009

Audit Configuration in Alfresco

Auditing is disabled by default, To enable auditing, some changes we need to made.
 here i explained in detailed where we need to change different audit related files.

go to auditConfig.xml, U can find this file in tomcat\webapps\alfresco\WEB-INF\classes\alfresco folder
change the value of enabled to true in place of false.

------------------------------------------------------------
<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 copy this file into extension folder.

Next go to extension folder in alfresco root i.e.,\tomcat\shared\classes\alfresco\extension\

create a new file, name it as a custom-audit-services-context.xml and add this below code
-----------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
<!-- The configuration of the audit model -->

<bean id="auditConfiguration" class="org.alfresco.repo.audit.AuditConfigurationImpl">
<property name="config">
<value>alfresco/extension/auditConfig.xml</value>
</property>
</bean>
</beans>
--------------------------------------------------------------------------------------------------

to turn on debug for audit information change log4j.properties which is located in

\tomcat\webapps\alfresco\WEB-INF\classes      uncomment the line  which is shown below...

log4j.logger.org.alfresco.repo.audit.model=DEBUG


also you can enable alfresco-global.properties which is located in \tomcat\shared\classes
---------------------------------------
#Audit Configuration
   audit.enabled = true
----------------------------------------

Also Enable file service and folder service in auditConfig.xml

-------------------------------------------------------------------------------
<!-- The File/Folder Service -->

<Service name="FileFolderService" mode="none">
<Method name="rename" mode="all"/>
<Method name="move" mode="all"/>
<Method name="copy" mode="all" auditInternal="true"/>
<Method name="create" mode="all"/>
<Method name="delete" mode="all"/>
<Method name="makeFolders" mode="all"/>
<Method name="getWriter" mode="all"/>
<Method name="getReader" mode="all"/>
</Service>

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


Restart the server  you will find tomcat screen like shown below


and add some documents to alfresco change some properties for that  documents like opening,editing, and set permissions to that documents
Next go to ViewDetails on that document you have edited, click preview in template and select show_audit.ftl from the dropdown menu. you should be able to see all of the actions you just carried out on that document.
you will find the screen as shown below.









Bookmark and Share

13 comments:

  1. Hello Chandu. Thank you for writing this post.

    I have enabled auditing and I think it is working. We have setup some simple workflows that enable users to "approve" or "reject" a document (which moves into 4 possible document spaces). For a given document I would like to see all users who have "approved" the document. Any ideas how I can construct a query?

    Thanks!

    ReplyDelete
  2. use mysql quires to get the data as per our requirement.

    just check out these links may helpful to you.

    http://forums.alfresco.com/en/viewtopic.php?f=19&t=19014

    http://wiki.alfresco.com/wiki/Auditing_(Up_to_V3.2)#MYSQL_samples

    ReplyDelete
  3. Hi,

    I just tried the way u mentioned in your blog but not able to get details in view details page.

    Any idea on it?Also can you please let me know on how i can use Java API to get list of content uploaded by a user in alfresco.

    Thanks a lot!

    ReplyDelete
  4. Hey thanq, i am new to java., i know only js API, i will try to use java API. soon i will do it. will give reply after i done with that work.

    thanks.

    ReplyDelete
  5. Nice tutorial, but i cant get it to work on version 3.3. Is the configuration that different?
    Best regards.

    ReplyDelete
  6. thanq spam. it will work for 3.3 also, other wise once add the below code in
    alfresco-global.properties

    audit.useNewConfig=true ,


    this is for new implementation of audit has been introduced into 3.2r n updated versions.

    good luck.

    ReplyDelete
  7. I still had problems using that code. My answer was found on this link: http://issues.alfresco.com/jira/browse/ALF-2222?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel

    It just requires overwritting the auditConfig.xml and adding:
    # Audit configuration
    audit.enabled=true
    audit.useNewConfig=false

    to tomcat\shared\classes\alfresco-global.properties file.

    Open it helps.

    ReplyDelete
  8. Thanks for the information, we will add this story to our blog, as we have a audience in this sector that loves reading like this” cms services

    ReplyDelete
  9. Hi!
    Excelent article, but…Do you have information about auditing in Alfresco 3.4.b ? The file auditConfig.xml just doesnt exist :S... I’ll appreciate any help, info, examples about that.
    Regards

    ReplyDelete
  10. Thanks, its very well explained.
    Just one thing, for 3.3, in custom audit content services, add string in values tag as classpath:alfresco/extension/auditConfig.xml.

    ReplyDelete
  11. Business users can easily complete form-driven processes through automated notifications and a web-based interface.


    alfresco workflow

    ReplyDelete