Audit.NET | extensible framework to audit executing operations | Model View Controller library

 by   thepirat000 C# Version: 21.0.1 License: MIT

kandi X-RAY | Audit.NET Summary

kandi X-RAY | Audit.NET Summary

Audit.NET is a C# library typically used in Architecture, Model View Controller, Framework applications. Audit.NET has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

An extensible framework to audit executing operations in .NET and .NET Core.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Audit.NET has a medium active ecosystem.
              It has 1980 star(s) with 308 fork(s). There are 80 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 473 have been closed. On average issues are closed in 46 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Audit.NET is 21.0.1

            kandi-Quality Quality

              Audit.NET has 0 bugs and 0 code smells.

            kandi-Security Security

              Audit.NET has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Audit.NET code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Audit.NET is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Audit.NET releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Audit.NET
            Get all kandi verified functions for this library.

            Audit.NET Key Features

            No Key Features are available at this moment for Audit.NET.

            Audit.NET Examples and Code Snippets

            No Code Snippets are available at this moment for Audit.NET.

            Community Discussions

            QUESTION

            Audit.NET Adding UserName to AuditLog when logging EF but can't reach HttpContext
            Asked 2022-Mar-25 at 11:27

            Context

            I am trying wireup Audit.Net in an MVC5 app with .Net Framework 4.8.

            Dataprovider: EntityFramework

            Output: Cosmos

            DI Provider: Autofac

            The Problem

            I have tried the following call backs to try and write the username to the AuditEvent.

            ...

            ANSWER

            Answered 2021-Oct-08 at 14:00

            The key (which might help in search terms) is async. A quick search for async httpcontext mvc gets us to this existing question with a lot of information about async/await and HttpContext usage.

            The super short version: in MVC, the HttpContext gets carried around in the thread synchronization context (which is also where, say, the culture and other thread settings are carried around) but it's expensive to cart that context from thread to thread so the default is to not do that. You need to enable it explicitly to work.

            Here's a blog article explaining the various knobs you can turn in web.config to get it to work but the net result is, basically, to make sure is set (well, set that value to 4.5 or higher).

            If that's already set, then... maybe there's something else at play, like a call has the ConfigureAwait(false) set on it so it's not returning to a thread context that has the HttpContext. But, more than likely, that httpRuntime flag should fix it.

            Source https://stackoverflow.com/questions/69489412

            QUESTION

            Cannot get Auditing of EntityFramework Core to work
            Asked 2021-Aug-26 at 13:07

            First, I installed the Audit Template and created a new project using the Audit.Net template. Using that project as a guide I tried to implement auditing on my actual project where I have an Asp.Net Core API (Project Name: EcommerceAPI). It also uses Entity Framework Core (in Library Project: Persistence). I have installed these NuGet packages only to EcommerceAPI:

            • Audit.EntityFramework.Core v18.1.3
            • Audit.WebApi.Core v18.1.3

            Here is my AuditConfiguration.cs file:

            ...

            ANSWER

            Answered 2021-Aug-26 at 13:07

            O.K. I had not gone all the way through the docs. This my failure to RTFM.

            I needed to install Audit.EntityFramework.Core on Persistence and change my DbContext to AuditDbContext. It is simple as that.

            Source https://stackoverflow.com/questions/68937241

            QUESTION

            Audit.Net customfields placement bahaves differently between manual scope creation and action based scope creation
            Asked 2021-Aug-09 at 17:48

            When using Audit.Net in WebApi a scope is created on every controller action event and when we add custom fields they appear at root level in the json. But when we create audit scope manually and if you add any custom fields to audit scope then they are nested under 'customfields' tag. Not sure why this behaviour is different for both the scope type creation.

            See the example below: This is generated by auditscope created when an action on controller is called: AuditInfo is added through auditScope.SetCustomField("AuditInfo",auditInfo);

            ...

            ANSWER

            Answered 2021-Aug-09 at 17:48

            This was fixed on the latest Audit.NET.AzureCosmos version.

            Issue: https://github.com/thepirat000/Audit.NET/issues/434

            The problem was because the Audit.NET.AzureCosmos library previoulsy used Microsoft.Azure.DocumentDB.Core which was coupled to Newtonsoft.Json, but Audit.NET targeting .NET 5.0 uses System.Text.Json, so the JsonExtensionData and other attributes required on the AuditEvent were not taken into account.

            Now when targeting .NET Standard 2.0 or .NET 5.0, the new client library Microsoft.Azure.Cosmos is used, and a custom serializer is set so the serializarion is handled by the default serialization mechanism from Audit.Core.Configuration.JsonAdapter

            Source https://stackoverflow.com/questions/68685056

            QUESTION

            Audit.Net targeting cosmos container based on the controller
            Asked 2021-Jul-10 at 00:48

            I'm using Audit.Net for logging all the controller actions in my application and it is an awesome library.

            I'm using Azure Cosmos DB to audit all the events. I'm using below setup to connect Cosmos DB:

            ...

            ANSWER

            Answered 2021-Jul-10 at 00:48

            A change could be requested here for the Azure Cosmos data provider to allow building the container name with a delegate function that takes the AuditEvent as a parameter.

            Similar to other data providers, like the SQL Server data provider.

            So you could setup like this:

            Source https://stackoverflow.com/questions/68314838

            QUESTION

            How to achieve generic Audit.NET json data processing?
            Asked 2021-Jun-25 at 17:51

            I am using Audit.Net library to log EntityFramework actions into a database (currently everything into one AuditEventLogs table, where the JsonData column stores the data in the following Json format:

            ...

            ANSWER

            Answered 2021-Jun-25 at 17:51

            Looks like you're asking for an opinion, in that case I would strongly recommend a document oriented DB.

            CosmosDB could be a great option since it supports SQL queries.

            There is an extension to log to CosmosDB from Audit.NET: Audit.AzureCosmos

            A sample query:

            Source https://stackoverflow.com/questions/68128212

            QUESTION

            Prevent Audit.Net from formatting BodyContent values as strings?
            Asked 2021-Apr-22 at 16:36

            I'm getting familiar with audit.net, and finding that the serialization isn't working quite right. I'm wondering if I need to add more configuration. My current config is as follows:

            ...

            ANSWER

            Answered 2021-Apr-22 at 16:36

            That's because the middleware can only access the response body already serialized as a byte array, so it's only decoded as string.

            On the other hand, the action filter can access the object before it's written to the response stream, so if you also add it to the pipeline, the audit event for the requests reaching an action method, will look like what you're expecting.

            For example, on your Startup class:

            Source https://stackoverflow.com/questions/67201854

            QUESTION

            Location header missing in response headers in Audit.Net
            Asked 2021-Mar-12 at 17:26

            When using Audit.Net I'm including entire response to be audited such as response content, headers and IncludeHeaders too, below is my configuration:

            ...

            ANSWER

            Answered 2021-Mar-12 at 17:26

            You should use the provided middleware in order to get the response headers, since most of the response headers are added on Result Filters which executes after the Action Filters, and the AuditApiGlobalFilter is an Action Filter.

            The recommended approach is to configure both the action filter and the middleware so you get specific information for the action and also any information added afterwards such as the response headers. Also, including the middleware will allow to audit requests that does not reach a controller/action.

            So just add the following to your startup:

            Source https://stackoverflow.com/questions/66598485

            QUESTION

            Audit.net ignoring Http Get methods with a global action filter
            Asked 2021-Mar-10 at 18:13

            I'm using Audit.net for auditing all .net core Web API requests. I want to use global action filter to audit all the HTTP requests but don't want to Audit HTTP GET methods. While configuring AddAuditFilter I can conditionally log action by using LogActionIf filter but unable to set the condition to check whether this action is related to Http Get. Any idea how to add conditional filter? I'm referring to below configuration:

            ...

            ANSWER

            Answered 2021-Mar-10 at 18:13

            What about using LogRequestIf which takes an HttpRequest as parameter:

            Source https://stackoverflow.com/questions/66562973

            QUESTION

            How to log Update(IList) action as multiple audit records using Audit.net
            Asked 2021-Feb-26 at 20:41

            I have to update bulk records in a table. I did it as following.

            BaseRepository.cs

            ...

            ANSWER

            Answered 2021-Feb-26 at 20:41

            You have at least two options

            Use the Entity Framework Data Provider

            If you can map the audit log table to an Entity Framework DbContext (it could be the same DbContext you are auditing or a different one), then you could use the EntityFramework Data Provider instead of the SQL Data Provider.

            For example, assuming you have an AuditLog table mapped to a DbContext:

            Source https://stackoverflow.com/questions/66362109

            QUESTION

            Audit.NET auditing 2 different contexts to 2 different databases
            Asked 2020-Dec-10 at 22:40

            I have an ASP.NET Core application with 2 contexts for 2 databases (context_1 and context_2). I want to audit both contexts ,using Audit.Net, to separate databases (context_audit_1 and context_audit_2)so I will have 4 databases in total.
            The problem is eventhough I am using different contexts in configuration, it is still auditing to one database. In other words, context_1 and context_2 are auditing to context_audit_1.
            Please see below the configuration I am using:
            Context_1

            ...

            ANSWER

            Answered 2020-Dec-10 at 22:40

            The problem is that you can't set more than one default data provider to save the events.

            So the second time the Audit.Core.Configuration.Setup().UseEntityFramework() is called, it will override the default data provider previously configured.

            But you can use the override of .UseDbContext() that provides a way to set the Audit DbContext to use on a per-event basis.

            So maybe you could have something like this:

            Source https://stackoverflow.com/questions/65211754

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Audit.NET

            You can download it from GitHub.

            Support

            If you like this project please contribute in any of the following ways:.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/thepirat000/Audit.NET.git

          • CLI

            gh repo clone thepirat000/Audit.NET

          • sshUrl

            git@github.com:thepirat000/Audit.NET.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link