Base solution for your next web application
Open Closed

How to get the custom identifier to identify from where this log entry is originated #10335


User avatar
0
mahendra created

Prerequisites

  • What is your product type (Angular or MVC)?
  • Angular
  • What is product framework type (.net framework or .net core)?
  • .net core

Hi Support,

As per your previous suggestions to implement the custom audit log to extend the current default auditlog to have our own additional logging in the new custom table, we have implemented IAuditingStore interface, to store all the audit log records in our custom table (i.e OEAuditLog).We are successfully able to log all the audit records in our custom table which includes default framework audit log and our own custom audit log.

Scenario:

Now, we want to analyze the recorded auditlog for better support to the end customer and smooth operations for our tech support staff.

We are planning to use the ‘CustomData’ field to group the auditlog records because we do not see any other field, which can by default help us to group the auditlog entries.

Please see below the function how we are saving the audit log:

Issue:

In the current function “SaveAsync”, param: auditInfo does not give us any info about the originator of the log. We mean to say that if we get the screen URL, or any custom identifier to identify from where this log entry is originated. We understand that we do get the “ServiceName” and “MethodName” in the auditInfo object. But, this is insufficient because the same service and the method is being called from many places in the whole project.

Therefore, imagine if an error occurs on the screen, then we would like to group the audit log records for this operation done by the user, which leads to an error.

We were thinking if we could pass or override something, which allow us to identify the originator of the log(s) and record the value in the custom data field. This way we inform the ASPNetZero framework that we are currently on XYZ module or screen or entity.

In addition, all the logs, which are generated because of this particular operation in the application, should be grouped with some common identifier, which will help eventually to fetch the relevant records and analyse it better for quick resolutions instead of going through thousands of records to find an issue.

Any help would be much appreciated.

Thanks,


3 Answer(s)
  • User Avatar
    0
    musa.demir created

    Hi @mahendra

    You can already filter audit logs by service name, method name or browser info etc. Did you check that?

  • User Avatar
    0
    mahendra created

    Hi musa.demir,

    Thanks for your reply.

    As we have mentioned in our earlier post: We understand that we do get the “ServiceName” and “MethodName” in the auditInfo object. But, this is insufficient because the same service and the method is being called from many places in the whole project

    Also, we have multiple screens/steps to complete one process on GUI and in the backend multiple services and methods are being called.

    We need one common identifier in the audit log to identify all these services and methods belong to one process on GUI.

    Could you please help us in achieving this.

    Thanks Best Regards,

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mahendra

    As you know, AppServices are hosted as APIs and audit logs are automatically written when an API method is called. So, this method can be called from your web app or any other external app.

    I think what you need is Referer information. You can access the HttpContext in your custom logger and get the Referer information and save it to customData field.