#1 2023-03-10 15:59:54

ConnectKaiser
Member
Registered: 2023-03-10

User Audit Logs Maintenance

Our Audit Logs RS_AUDIT_LOG_ENTRY and RS_AUDIT_LOG_PROPERTY are logging data since 2016. Meanwhile we have 5 and 16 Mio entries.
Is it possible to delete all entries before eg 2020 without side effects (FK violation..)?

According to
https://forum.reportserver.net/viewtopic.php?id=699
and
https://reportserver.net/en/guides/admi … intenance/
it is possible with scripting. Do you have such a script?

Thanks in advance
Jens

Last edited by ConnectKaiser (2023-03-10 17:00:40)

Offline

#2 2023-03-13 10:32:39

eduardo
Administrator
Registered: 2016-11-01
Website

Re: User Audit Logs Maintenance

Hi Jens,

you can use the following for deleting all log entries before a given date.

DELETE FROM RS_AUDIT_LOG_PROPERTY WHERE
LOG_ENTRY_ID IN(
   SELECT
   ENTITY_ID
   FROM
   RS_AUDIT_LOG_ENTRY
   WHERE
   DATE_FIELD < "${date}"
)

DELETE FROM RS_AUDIT_LOG_ENTRY WHERE DATE_FIELD < "${date}"

This can be of course integrated into a script using Groovy SQL: https://docs.groovy-lang.org/latest/htm … l/Sql.html

Regards,
Eduardo

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB