Open Closed

Disable the audit for the API, #6563


User avatar
0
dev@veek.vn created

Hi, I want to disable the audit for the API, but it doesn't work.

this is my code:

[RemoteService]
[Area("app")]
[ControllerName("Job")]
[Route("api/app/jobs")]`

[DisableAuditing]
[HttpGet]
[Route("sync-robot-drivers")]
public Task SyncRobotCodesHasDriver()
{
    return _jobAppService.SyncRobotCodesHasDriver();
}

Configure<AbpAspNetCoreAuditingOptions>(options =>
{
    var ignoredUrls = new[]
    {
        "/jobs",
    };
    
    foreach (var url in ignoredUrls)
    {
        options.IgnoredUrls.AddIfNotContains(url);
    }
});

ABP Framework version: v.7.3.2 UI Type: Angular Database System: MongoDB Tiered (for MVC) or Auth Server Separated (for Angular): yes Exception message and full stack trace: Steps to reproduce the issue:

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

8 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello ,

    Please check this similar issue https://support.abp.io/QA/Questions/3901/DisableAuditing-not-working-on-Controller-and-Controller-Action

    Thank you.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev@veek.vn created

    For the route "/api/app/jobs/sync-robot-drivers"

    I have setup like this but doesn't work

    var ignoredUrls = new[]
                {
                    "/jobs",
                };
    
    foreach (var url in ignoredUrls)
    {
        options.IgnoredUrls.AddIfNotContains(url);
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi,

    Can you please try with this code

    Configure<AbpAspNetCoreAuditingOptions>(options => { options.IgnoredUrls.AddIfNotContains("/api/app/jobs/sync-robot-drivers"); });

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev@veek.vn created

    Hmm, that's weird, it still isn't working.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev@veek.vn created

    I have added [DisableAuditing] on controller, api and IgnoredUrls on AbpAspNetCoreAuditingOptions

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi,

    could you please check is there any logs?

    Can you please confirm once where are you adding this provided code? please check this documentation https://docs.abp.io/en/abp/latest/Audit-Logging#abpaspnetcoreauditingoptions

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev@veek.vn created

    Hi, I have debugged the issue, and although it goes to the highlight, it still stores data in the audit table.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi, I have followed below steps and it works properly at my end.

    1. Add AbpAudit Module as a project.

    2. I have added this code in hostmodule.cs file in ConfigureServices() method. Configure<AbpAspNetCoreAuditingOptions>(options => { options.IgnoredUrls.AddIfNotContains("/api/app/books"); });

    3. Add [DisableAuditing] in a controller or appservice.

    After following above steps when I call api the entry is not added in AuditLogs table. I think this is what you want , right ?

    Please let me know , If anything else required.

    Thanks,

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 09, 2026, 11:56
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.