You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2023/12/12 16:25:23 UTC

Re: CUSTOM events in Audit

On 27/11/23 16:01, Lionel SCHWARZ wrote:
> ----- Le 27 Nov 23, à 14:43, Lorenzo Di Cola <lo...@apache.org> a écrit :
>
>     Hi Linonel,
>     yes, using PostgreSQL JSONB means you're storing audit on db, as you said about "auditentry" table.
>     You can take care about AnySearchDAO bean, you should use the one of type PGJPAJSONAnySearchDAO in order to use PostgreSQL feature.
>
> Sorry Lorenzo, I don't get your point at all, I have no idea what to do with this PGJPAJSONAnySearchDAO bean...
>
> As I explained in my first message, basically what I did is:
> 1. activated audit for "syncope.audit.[CUSTOM]:[]:[]:[MY_EVENT]:[SUCCESS]"
> 2. triggered the event "MY_EVENT" somewhere in my code
> 3. got empty list when requesting  "/syncope/rest/audit/entries?type=CUSTOM"
>
> So my question is: is it normal that audit for CUSTOM events are not stored ? (audit is fine for non-custom event type)
We have added a dedicated integration test case to check this condition:

https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java#L667

You might also want to have a look at the class that is actually triggering a custom audit event, for reference:

https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/resources/CustomAuditLogicActions.groovy

HTH
Regards.

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Re: CUSTOM events in Audit

Posted by Lionel SCHWARZ <li...@in2p3.fr>.
----- Le 12 Déc 23, à 17:25, Francesco Chicchiriccò <il...@apache.org> a écrit : 

> On 27/11/23 16:01, Lionel SCHWARZ wrote:

>> ----- Le 27 Nov 23, à 14:43, Lorenzo Di Cola [ mailto:loredicola@apache.org |
>> <lo...@apache.org> ] a écrit :

>>> Hi Linonel,
>>> yes, using PostgreSQL JSONB means you're storing audit on db, as you said about
>>> "auditentry" table.
>>> You can take care about AnySearchDAO bean, you should use the one of type
>>> PGJPAJSONAnySearchDAO in order to use PostgreSQL feature.

>> Sorry Lorenzo, I don't get your point at all, I have no idea what to do with
>> this PGJPAJSONAnySearchDAO bean...

>> As I explained in my first message, basically what I did is:
>> 1. activated audit for "syncope.audit.[CUSTOM]:[]:[]:[MY_EVENT]:[SUCCESS]"
>> 2. triggered the event "MY_EVENT" somewhere in my code
>> 3. got empty list when requesting "/syncope/rest/audit/entries?type=CUSTOM"

>> So my question is: is it normal that audit for CUSTOM events are not stored ?
>> (audit is fine for non-custom event type)

> We have added a dedicated integration test case to check this condition:

> [
> https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java#L667
> |
> https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java#L667
> ]

> You might also want to have a look at the class that is actually triggering a
> custom audit event, for reference:

> [
> https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/resources/CustomAuditLogicActions.groovy
> |
> https://github.com/apache/syncope/blob/3_0_X/fit/core-reference/src/test/resources/CustomAuditLogicActions.groovy
> ]
Hi Francesco, 
That's exactly what I did afterward: trigger the audit event with the Audit Manager, and this works fine. 
Actually In the first place, I thought that triggering a Notification would trigger automatically an audit event... 
Thanks anyway 
Lionel