Hi,
Since I started working with Alfresco over 14 years ago I've read and reread Audit related documentation a ton of times and "more or less" I managed to make "some" sense of it. But one of the supposedly easiest parts of it still scape my understanding, DataGenerators.
For example, imagine I have this audit application :
<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" /> </DataExtractors> <DataGenerators> <DataGenerator name="personFullName" class="org.alfresco.repo.audit.generator.AuthenticatedPersonDataGenerator"/> </DataGenerators> <PathMappings> <PathMap source="/alfresco-access" target="/acme" /> </PathMappings> <Application name="acme" key="acme"> <GenerateValue key="fullname" dataGenerator="personFullName" /> <AuditPath key="transaction"> <RecordValue key="node" dataExtractor="simpleValue" dataSource="/acme/transaction/node" dataTrigger="/acme/transaction/node" /> <GenerateValue key="fullname" dataGenerator="personFullName" /> <GenerateValue key="action" dataGenerator="personFullName" /> </AuditPath> </Application> </Audit>
I would expect to have in the generated audit trace values a map of entrys like:
/acme/fullname: "Administrator" /acme/transaction/node: "workspace://SpacesStore/what-ever" /acme/transaction/fullname: "Administrator" /acme/transaction/action: "Administrator"
But I just get:
/acme/transaction/node: "workspace://SpacesStore/what-ever"
I can't make any sense of it.
The doc says "data is produced when a data path is active," and in fact in the code I've seen that it is checking against the full keys of all mapped values, but I don't understand why and how this is supposed to be used. In fact my last attempt in the config where I am traying to map the full name to "action" tries to use a supposedly "activated path" but it doesn't work either.
Shouldn't it just generate a value for the specified key and that's all? What am I missing ?
Has anyone ever used DataGenerators succesfully?
As far as I can remember from the last time I wrote an audit application, generators are only triggered if a key-value entry is contained in the inbound value map that exactly matches the path of the enclosing AuditPath element. It does not suffice if a value exists that matches a the path of a RecordValue in the same AuditPath. You can see this in the default alfresco-access audit application. There they map /alfresco-api/pre/ticketComponent/invalidateTicketById/args - which is the full map of named arguments (they are not split into separate paths each) - to /alfresco-access/logout which is an AuditPath that contains a GenerateValue element.
One could say this is a rather "stupid" / naiive implementation by Alfresco, or even a hack, but you have to keep in mind that auditing was never really developed to be extensible / used for anything else than the defaults that Alfresco provides (admitted that way to me by an Alfresco engineer at a DevCon / Summit conference), so as long as it worked for them, they were fine and did not consider other uses.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.