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)
-
0
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:
- Create a class implements IAuditingStore. Save audit logs to nosql db or any destination you like.
- 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.
-
0
Thanks! I will investigate how to integrate your recommendations.