Base solution for your next web application
Open Closed

Issue Audit log display for large parameter value #1689


User avatar
0
vitaly created

When large object [more than nvarchar(1024)] is pushed as parameter value to AbpAuditLogs it will be trancated.

Example: {"input":{"bla":{"bla bla":null,"bla bla bla":null,<span style="color:#FF0000">...</span>

If we will try to display Audit logs then vm.getFormattedParameters will fail as Unexpected token . in JSON at position 1021, because the object was trancated and is not valid anymore.

Question: how could that be fixed for production? Can we move Audit Logs to NoSQL db for example?


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    As a workaround, you can change behaviour of the getFormattedParameters method. For example, you can use a try-catch and return non-formatted string value as a fallback. We'll do it, I created an issue, you can follow it: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/341">https://github.com/aspnetzero/aspnet-zero/issues/341</a>

    You can write audits any destination you want. To do that:

    1. Create a class implements IAuditingStore. Save audit logs to nosql db or any destination you like.
    2. Replace YourAuditingStore with the default IAuditingStore in PreInitialize method of your method as described here: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Startup-Configuration#replacing-built-in-services">http://www.aspnetboilerplate.com/Pages/ ... n-services</a>

    This was for saving part. If you want to get audit logs from nosql db, then you should also change AuditLogAppService in your project.

  • User Avatar
    0
    vitaly created

    Thanks! I will investigate how to integrate your recommendations.