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:
- Code: Select all
...
<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:
- Code: Select all
<?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