Open Closed

Issue with audit logging is not capturing API requests #6816


User avatar
0
dev@veek.vn created

hi,

I have added a new application to OpenIddict using this URL: domain.com/openiddict/Applications. I successfully used the client ID and client secret to obtain a token. However, when I call the API from Postman with that token, my request is not saved in the audit log. I have enabled audit logging, but it still does not work. Please help me.

ABP Framework version: v7.3.2 UI Type: Angular Database System: MongoDB Tiered (for MVC) or Auth Server Separated (for Angular): Yes Exception message and full stack trace: [Provide any relevant details] Steps to reproduce the issue:


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

    Hi,

    HTTP GET requests should not make any change in the database normally and audit log system doesn't save audit log objects for GET request. Set this to true to enable it also for the GET requests.

    https://docs.abp.io/en/abp/latest/Audit-Logging#abpauditingoptions

    You can try a POST request.

  • User Avatar
    0
    dev@veek.vn created

    Ok, how can I enable for GET request and only apply for my client?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Yes, you can configure the AbpAuditingOptions,

    For example:

    Configure<AbpAuditingOptions>(options =>
    {
        options.AlwaysLogSelectors.Add((info =>
        {
            if(info.ClientId == "Your client id")
            {
                return Task.FromResult(true);
            }
            
            return Task.FromResult(false);
        }));
    });
    

    See also: https://docs.abp.io/en/abp/latest/Audit-Logging#abpauditingoptions

  • User Avatar
    0
    dev@veek.vn created

    thanks liangshiwei

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11