DataGenerators not working in my Audit applications

cancel
Showing results for 
Search instead for 
Did you mean: 
iblanco
Active Member II

DataGenerators not working in my Audit applications

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?

 

 

1 Reply
afaust
Master

Re: DataGenerators not working in my Audit applications

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.