cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Audit record in Backoffice

Former Member
0 Likes
3,357

Hello community,

I have recently used the audit records to solve a quite serious bug we had in our system. The audit records are step by step changes on for example a cart. Every time an item is saved it gets an audit record with a before and after state and this is saved as JSON in the database. The difference as far as I've seen between a Saved value and an audit record is that a saved value will be removed with the item it was written on. It is linked in the model layer. An audit is of a completely separate system and the entity lives on even after the item it recorded was removed from Hybris.

In order to go through the life of the cnd all changes made to it I had to go to the scripting console in HAC:

 query = AuditSearchQuery.forType(StockCartModel._TYPECODE)
         .withPkSearchRules(PK.fromLong(8815124381739L))
         .build()
  
 audits = defaultReadAuditGateway.searchForStandardAudits(query).collect(Collectors.toList())
  
 record = audits.get(0)
  
 before = record.getAttributesBeforeOperation()
  
 after = record.getAttributesAfterOperation()

That works but it isn't that optimal. I am unaware if there is a list for audit records on a specific item in Backoffice. If there isn't, why? I mean it would be much easier and make these audit records useful if you could on an item in Backoffice have a button so that when pressed it does exactly my query and displays each JSON result so that you can follow all the changes of the cart from CREATION.

It would also be nice to be able to list the audit records by type since they are the largest tables in the entire database due to how you store them and never remove them. In this list we could then find the the cart if it has been removed and follow its life in Hybris all the way to the moment it was DELETED.

P.S: since Hybris never removes audit records. Are these GDPR safe?

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

Hello again,

We are now moving to the SAP commerce cloud V2 and there the instructions says to disable audit records altogether. So, this is no longer relevant since Hybris, or their new name SAP commerce, themselves suggest to not use audit records at all in a production environment. So why even have a UI for a feature that is never supposed to be used anyways.

So bye bye audit records. From my perspective you will not be missed.

Former Member
0 Likes

They have been added to fulfill some GDPR requirements which are now supported differently. And yet we have to live with this hacky boilerplate destroying total environments just because it was silently added and activated by default some time ago. Never used them, never needed them, and if requested I'd solve things with database audits in the RDMS itself. Solved. 🙂

Former Member
0 Likes

Hi,

If you dont want make use auf audit records, you can disable them for certain types. https://help.hybris.com/1811/hcd/3e2b8491449d43b391eb1ce9c73cbb7f.html

For example: audit.user.enabled=false

Former Member
0 Likes

That is correct, however the main question is why there isn't a default audit record interface in Backoffice or HAC. I had to implement that myself.