Base solution for your next web application
Open Closed

Change Auditing data store #8032


User avatar
0
zdeen created

We are trying to save all AbpAuditLogs to Azure Kusto databse. While we understand there won't be direct integration option what I am trying to do is replace the inbuilt auditing to save these details in EventHub and then move it to Kusto. The EventHub to Kusto injestion is something which I would work later but need help in getting few pointers how the existing Auditing in AspNet zero can be replaced so that audited logs are sent to datastore of my choice instead of SQL Server table.

This documnet https://aspnetboilerplate.com/Pages/Documents/Audit-Logging descibed how can we enable and disable it but just looking on options on I can extend it further. Thanks a lot for the help in advance.


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

    You only need to implement IAuditingStore and then replace it in dependency injection.

    public override void PreInitialize()
    {
    	Configuration.ReplaceService<IAuditingStore, MyAuditingStore>();
    }
    

    Someone has developed a module that stores the audit log in MongoDb, you can take a look. https://github.com/GameBelial/Abp.Auditing.MongoDb

  • User Avatar
    0
    zdeen created

    Thanks for the pointers. I was able to integrate the same.Have few followup question which probably would can guide me

    1. I want to include GUID with every request for ApplicationService.It can be an ActivityId which would be a unique GUID for every request from a user.Incase of error I can add this GUID to error message to user and it can be further used to check AuditLogs to find what was the exception.
    2. Would extending AuditInfo class help or I would need to comeup with my own interceptor.
    3. ExecutionDuration of AuditInfo does it handles async and sync call seperate and give correct duration for async calls.
    4. What is ReturnValue in AuditInfo class.

    Thanks a lot for the help.

  • User Avatar
    0
    maliming created
    Support Team

    I want to include GUID with every request for ApplicationService.It can be an ActivityId which would be a unique GUID for every request from a user.Incase of error I can add this GUID to error message to user and it can be further used to check AuditLogs to find what was the exception.

    You can refer to this: https://www.stevejgordon.co.uk/asp-net-core-correlation-ids

    Would extending AuditInfo class help or I would need to comeup with my own interceptor.

    You can try it, if it is not possible or difficult to extend, you can implement it yourself.

    ExecutionDuration of AuditInfo does it handles async and sync call seperate and give correct duration for async calls.

    Yes. see https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Auditing/AuditingInterceptor.cs

    What is ReturnValue in AuditInfo class.

    see https://github.com/aspnetboilerplate/aspnetboilerplate/pull/4198

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.