Base solution for your next web application
Open Closed

Periodic Audit Log Deletion #8754


User avatar
0
-bitman created

Hello ANZ Team,

I would like to understand how to enable this new feature in 8,2?

Please advise. Thank you.


7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Set Configuration.Auditing.IsEnabled and ExpiredAuditLogDeleterWorker.IsEnabled to true.

    if (Configuration.Auditing.IsEnabled && ExpiredAuditLogDeleterWorker.IsEnabled)
    {
        workManager.Add(IocManager.Resolve<ExpiredAuditLogDeleterWorker>());
    }
    
  • User Avatar
    0
    -bitman created

    Thank you @maliming. Is this something that automatically sets the expiration of the audit logs or is there a configuration that we need to set to tell the system when the logs get expired? How long is the default age when the logs get deleted?

  • User Avatar
    0
    maliming created
    Support Team

    hi @ramilcatalandomingo

    You can see the source code of ExpiredAuditLogDeleterWorker.

    https://github.com/aspnetzero/aspnet-zero-core/blob/d2abf335efab309cc8f4717e2c27372831662dc5/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/Auditing/ExpiredAuditLogDeleterWorker.cs#L18

  • User Avatar
    0
    -bitman created

    Thank you @maliming

  • User Avatar
    0
    -bitman created

    Hello @maliming,

    Just to be sure I am doing the right thing. Attached are my changes. Please advise.

    Thank you!

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Your code looks fine, you can debug to see if this worker is performing as expected.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ramilcatalandomingo,

    Yes, that's correct :)