Thursday, May 24, 2012

Auditing custom content types

Sometimes in important application requires auditing data. Alfresco provides auditing facility based on nodes behavior and actions.
In most cases out of box audit configuration is enough to satisfy the requirements, but sometime it requires certain kind of data also needs to be audited. Like we are auditing our own custom content types.

I have tested below configuration in Alfresco version 4.0 EE

E.g. I have my own custom content type say "clm:contract" and I want to monitor changes inside this node whether its create/read/update/delete.

We are including following configuration in alfresco-global.properties file to achieve this.

audit.enabled=true
audit.alfresco-access.enabled=true
audit.alfresco-access.sub-actions.enabled=true




### Audit Filter ### audit.filter.alfresco-access.default.enabled=true audit.filter.alfresco-access.transaction.user=~System;~null;.* audit.filter.alfresco-access.transaction.type=cm:folder;cm:content;st:site;clm:contract audit.filter.alfresco-access.transaction.path=~/sys:archivedItem;~/ver:;.*

Above configuration is enough to detect your custom content type clm:contract and auditing it.
If you want to see detailed log in console just write below configuration in log4j.properties file.

### Audit Logs ###
log4j.logger.org.alfresco.repo.audit.AuditComponentImpl=DEBUG
log4j.logger.org.alfresco.repo.audit.inbound=DEBUG

EnJOy !!



11 comments:

  1. Ghanshyam this will generate Audit logs how can we store that logs permanently ?

    ReplyDelete
  2. Great article , I want to know how to audit event for content download.
    You r help is appreciated well in advance

    ReplyDelete
  3. Ghanshyam can you help using some example for auditing WiKi page is confusing me. Thanks

    ReplyDelete
  4. @Anonymous : Audit logs are persisted in db but you require query to get those.
    Try from http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Faudit-config.html

    ReplyDelete
  5. @Rajinder : Content READ operation is also consider as download event. so keep enable it in your config XML for auditing.

    ReplyDelete
  6. @Karuna : what exactly you are looking for?

    ReplyDelete
  7. If i need audit filter about sub-action.
    How to include configuration in alfresco-global.properties file ?
    Example.
    audit.filter.alfresco-access.transaction.sub-action.00.user=user1
    But it does not work for me.

    Sorry for my english.

    ReplyDelete
    Replies
    1. Can you please elaborate little about your line

      audit.filter.alfresco-access.transaction.sub-action.00.user=user1

      1) sub-action.00.user ??
      alfresco-access is alfresco's out of box application configuration for audit. Did you make any changes in it?

      Delete
  8. How to track IP address of Client while auditing in alfresco?

    ReplyDelete