Open Closed

How to implement auditing of API calls from Module #8545


User avatar
0
suresht created
  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  • I am unable to find examples that show how to implement a central way of auditing API calls from Module to other systems. I have reviewed details at the following link and am following them:
  • https://abp.io/support/questions/218/AbpAuditLogs-and-AbpAuditLogActions
  • Is there a SQL table that is used for audit logging in abp.io like in abp (AbpAuditLogs table)? If so, is there an example you can provide?
  • Thanks

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, I don't quite understand.

    If you want to get audit logging, you can inject IAuditLogsAppService or IAuditLogRepository

  • User Avatar
    0
    suresht created

    Hi,

    I implemented auditing using IAuditingManager. On the Host side, IntegrationServicesTimeCardServiceModule class, the following code has been added:

    app.UseAuditing()
    

    On the Module (Services) side, the following code has been added:

    Configure<AbpAuditingOptions>(options =>
            {
                options.IsEnabled = true;
                options.IsEnabledForGetRequests = true;
                options.ApplicationName = configuration.GetValue<string>("ApplicationName");
            });
    

    There are no errors when executing the application and testing any endpoint. However, there are no entries in the [AuditLoggingService_dev].[dbo].[AbpAuditLogs] table.

    I shared a One Drive link with you so that you can review all code on the Host and Module sides. Please let me know what is incorrect with the implementation and your suggestion on how to fix it.

    Thanks.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You create a new AwsAuditingStore and write nothing.

    if you want to save audit logs to the database, you should remove it and add typeof(AbpAuditLoggingEntityFrameworkCoreModule), to your IntegrationServicesTimeCardServiceModule

  • User Avatar
    0
    suresht created

    Hi,

    Thanks for your suggestion. I was able to fix the issue.

    Thanks.

Made with ❤️ on ABP v9.2.0-preview. Updated on January 23, 2025, 12:17