Audit.NET is a free, open source compliance & risk management project written in C# and released under MIT. It has 2,651 GitHub stars, 328 forks and 1 open issues, and was last pushed yesterday. On this registry it ranks #28 of 45 tracked projects in Compliance & Risk Management, with 5 head-to-head comparisons available. It gained 1 stars over the last 3 tracked days.

What is Audit.NET?

What it is

Audit.NET is an extensible framework for auditing executing operations in .NET and .NET Core. It lives in the Microsoft .NET ecosystem, where applications need a way to record what happened during runtime procedures and to preserve evidence for later reconstruction and examination. The project is written in C# and is distributed under the MIT license.

The concrete problem it solves is the lack of built-in, detailed tracking for operations that affect an application or its dependencies. Audit.NET generates audit logs that capture environmental data such as the caller's user ID, machine name, method name, exceptions, and execution time. It also provides an extensible mechanism to enrich logs and manage audit outputs, so teams can store and review operation evidence in a form that fits their infrastructure.

Key capabilities

  • It captures environmental data such as the caller's user ID, machine name, method name, exceptions, and execution time.
  • It provides interaction extensions for Entity Framework, MVC, WebAPI, WCF, WCF Client, File System, SignalR, MongoClient, gRPC Client, gRPC Server, MediatR, Hangfire, Azure Functions, and HttpClient.
  • It provides output extensions for JSON files, Event Log, OpenTelemetry spans, SQL, MySQL, PostgreSQL, and RavenDB.
  • It supports custom fields and comments to enrich audit events.
  • It provides event creation policy and configuration controls for audit event generation.

Who uses it and how

  • Applications using Entity Framework can add audit logging to data operations.
  • MVC and WebAPI services can use the framework to audit web request processing.
  • WCF services and WCF clients can use it to audit service operations and client interactions.
  • File system operations, MongoClient calls, gRPC calls, SignalR hubs, MediatR handlers, Hangfire jobs, Azure Functions, and HttpClient requests can be audited through the corresponding extensions.

Getting started

Integrate the C# library into a .NET or .NET Core application, then configure an interaction extension and an output provider. The project does not list a Docker image, package manager, or hosted option.

When to use it — and when not to

Use Audit.NET when a .NET or .NET Core application needs framework-level audit trail generation and the team can select and configure an appropriate output provider. A self-hoster must operate or choose the storage and logging targets, such as SQL, MySQL, PostgreSQL, RavenDB, JSON files, Event Log, or OpenTelemetry spans. No hosted option, installer, or Docker image is listed, so setup and operations remain local to the application and its chosen storage or logging target.

project readme (upstream, from github) — read inline

Audit.NET

USAGE | OUTPUT | CUSTOMIZATION | DATA PROVIDERS | CREATION POLICY | CONFIGURATION | EXTENSIONS

Issues Build status Quality gate Donations Docs
issues-open issues-closed build-status Quality Gate Status Coverage paypal Ask DeepWiki

An extensible framework to audit executing operations in .NET and .NET Core.

Generate audit logs with evidence for reconstruction and examination of activities that have affected specific operations or procedures.

With Audit.NET, you can generate detailed tracking information for executed operations. It captures environmental data such as the caller's user ID, machine name, method name, exceptions, and execution time. The framework also provides an extensible mechanism to enrich logs and manage audit outputs.

NuGet

NuGet Status NuGet Count

To install the package run the following command on the Package Manager Console:

PM> Install-Package Audit.NET

Changelog

Check the CHANGELOG.md file.

ZZZ Projects - Sponsorship

Entity Framework Extensions and Dapper Plus are major sponsors and are proud to contribute to the development of Audit.NET

Combine the power of auditing with the speed of Bulk Operations to get the best of both worlds — audit and performance.

Entity Framework Extensions - Sponsor

Dapper Plus - Sponsor

Introduction

The Audit Scope and Audit Event are the central objects of this framework.

Audit Scope

The AuditScope serves as the central object in this framework, representing the scope of an audited operation or event. It acts as a context for auditing, capturing pertinent details like the start time, involved entities, and any additional custom information. Essentially, the AuditScope encapsulates an AuditEvent, controlling its life cycle.

The AuditScope is a disposable object, commonly utilized within a using statement to ensure proper finalization and recording of audit information upon exiting the scope.

See the audit scope statechart.

Audit Event

The AuditEvent functions as an extensible information container that captures the details of the audited operation, is the representation of the audited information within an Audit Scope. It includes details about the audited operation, such as the event type, timestamp, execution duration, and any custom fields or properties.

The AuditEvent is typically serialized into a format suitable for storage or transmission, such as JSON.

The audit events are stored using a Data Provider. You can use one of the available data providers or implement your own.

Audit Scope Factory

The preferred method for creating audit scopes is by using an IAuditScopeFactory instance. This approach ensures a centralized and consistent configuration for all audit scopes.

var factory = new AuditScopeFactory();
using var scope = factory.Create(new AuditScopeOptions(...));
...

If you're using a DI container, you can register the IAuditScopeFactory as a se

readme truncated — read the full docs on github

Frequently asked questions

Is Audit.NET free to use?

Audit.NET is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does Audit.NET do?

An extensible framework to audit executing operations in .NET

What is Audit.NET written in?

Audit.NET is primarily written in C#. Its source is publicly available at https://github.com/thepirat000/Audit.NET, and it has 2,651 GitHub stars.