How to modify Alfresco's out-of-the-box audit

2019-08-31 09:15发布

I am trying to modify the PathMappings of the "CMISChangeLog" audit application bundled out-of-the-box in Alfresco 5.

I have found these PathMappings in alfresco-audit-cmis.xml which can be found in Alfresco's source code, so I modified this XML file and put it into tomcat/shared/classes/alfresco/extension/audit/alfresco-audit-cmis.xml (thinking that would override the out-of-the-box application) before restarting Alfresco. Problem:

ERROR [audit.model.AuditModelRegistryImpl] Failed to load audit model: file:/home/nico/alfresco/tomcat/shared/classes/alfresco/extension/audit/alfresco-audit-cmis.xml
org.alfresco.repo.audit.model.AuditModelException: 00120000 Audit application key 'CMISChangeLog' is used by: AuditApplication[ name=CMISChangeLog, id=3, disabledPathsId=381]
  at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState.cacheAuditElements(AuditModelRegistryImpl.java:646)

How to override this out-of-the-box audit application?

Grepping through my server I found out that the default audit application's XML file is stored at alf_data/contentstore/2017/12/22/18/23/82dfdccd-6ab9-4091-8b7c-d37d4bcf1627.bin but I haven't found it in the Node Browser:

enter image description here

Note: I don't want to create a new audit application. I must modify the existing one (because I want Alfresco's CMIS ChangeLog to take into account more events).

1条回答
Evening l夕情丶
2楼-- · 2019-08-31 09:38

The XML file is actually in alfresco-repository-5.2.g.jar, which itself can be found in Alfresco's WAR file.

So, if you have an already running Alfresco server, here is the procedure:

  1. Stop Alfresco
  2. mkdir -p /tmp/unjar
  3. cd /tmp/unjar
  4. unzip $ALFRESCO/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.g.jar (adapt for another version number if necessary)
  5. Do the modifications you want inside the extracted file alfresco/audit/alfresco-audit-cmis.xml
  6. zip -r ../alfresco-repository-5.2.g-custom.jar *
  7. cp ../alfresco-repository-5.2.g-custom.jar ALFRESCO/tomcat/webapps/alfresco/WEB-INF/lib/
  8. Restart Alfresco
查看更多
登录 后发表回答