Audit.NET.ImmuDB
30.0.2
dotnet add package Audit.NET.ImmuDB --version 30.0.2
NuGet\Install-Package Audit.NET.ImmuDB -Version 30.0.2
<PackageReference Include="Audit.NET.ImmuDB" Version="30.0.2" />
<PackageVersion Include="Audit.NET.ImmuDB" Version="30.0.2" />
<PackageReference Include="Audit.NET.ImmuDB" />
paket add Audit.NET.ImmuDB --version 30.0.2
#r "nuget: Audit.NET.ImmuDB, 30.0.2"
#:package Audit.NET.ImmuDB@30.0.2
#addin nuget:?package=Audit.NET.ImmuDB&version=30.0.2
#tool nuget:?package=Audit.NET.ImmuDB&version=30.0.2
Audit.NET.ImmuDB
ImmuDB provider for Audit.NET
Store audit events in an ImmuDB database.
ImmuDB is an immutable, tamper-evident database ideal for audit trails and compliance.
See the ImmuDB documentation for more details.
Install
NuGet Package
PM> Install-Package Audit.NET.ImmuDB
Usage
Please see the Audit.NET Readme
Configuration
Set the static Audit.Core.Configuration.DataProvider
property to set the Immu DB data provider,
or call the UseImmuDb
method on the fluent configuration. This should be done before any AuditScope
creation, i.e. during application startup.
For example:
Audit.Core.Configuration.DataProvider = new ImmuDbDataProvider()
{
ClientBuilderAction = b => b
.WithServerUrl("localhost")
.WithServerPort(3322)
.WithDatabase("db")
.WithCredentials("admin", "password"),
UseVerifiedMethods = true,
KeySelector = _ => Guid.NewGuid().ToByteArray()
};
Or by using the fluent configuration API:
Audit.Core.Configuration.Setup()
.UseImmuDb(config => config
.ClientBuilder(b => b
.WithServerUrl("localhost")
.WithServerPort(3322)
.WithDatabase("db")
.WithCredentials("admin", "password"))
.UseVerifiedMethods()
.KeySelector(_ => Guid.NewGuid().ToByteArray()));
You can also configure the provider to use different database and credentials based on an audit event criteria. For example:
Audit.Core.Configuration.Setup()
.UseImmuDb(config => config
.ClientBuilder(b => b
.WithServerUrl("localhost")
.WithServerPort(3322))
.Database(auditEvent => auditEvent.EventType == "Http" ? "db1" : "db2")
.Username(auditEvent => auditEvent.EventType == "Http" ? "user1" : "user2")
.Password(auditEvent => auditEvent.EventType == "Http" ? "password1" : "password2")
.UseVerifiedMethods()
.KeySelector(_ => Guid.NewGuid().ToByteArray()));
The key
used to store the audit event in the ImmuDB database is generated by the KeySelector
function. If not specified, a random Guid is used.
The value
stored in the ImmuDB database is generated by the ValueSelector
function. If not specified, the serialized audit event in UTF8 JSON format is used.
You can customize the value stored by providing a ValueSelector
function that extracts the desired data from the audit event.
For example:
Audit.Core.Configuration.Setup()
.UseImmuDb(config => config
.ClientBuilder(b => b
.WithServerUrl("localhost")
.WithServerPort(3322)
.WithDatabase("db")
.WithCredentials("admin", "password"))
.ValueSelector(auditEvent => $"{auditEvent.StartDate}: {auditEvent.EventType}"));
Provider options
ClientBuilder
: A function to create the ImmuDB client. If not set, a client with the default settings will be used.DatabaseName
: The name of the database to use when connecting to the ImmuDB server. If not specified, the value defined in the client builder is used, which defaults to "defaultdb".Username
: The username to use when connecting to the ImmuDB server. If not specified, the value defined in the client builder is used, which defaults to "immudb".Password
: The password to use when connecting to the ImmuDB server. If not specified, the value defined in the client builder is used, which defaults to "immudb".KeySelector
: A function to select the key for the audit event. If not specified, the default key selector is used, which generates a unique key based on the event's ID.ValueSelector
: A function to select the value to store from the audit event. If not specified, the default value selector is used, which serializes the event to UTF8 JSON format.UseVerifiedMethods
: A boolean indicating whether to use verified methods for writing events. If set totrue
, uses verified writes for tamper-evidence. Default is falseExpirationTimeout
: An optional expiration timeout for the audit events. If set, the events will be automatically deleted after the specified time. The value is aTimeSpan
representing the duration after which the event should expire. If not set, events will not expire.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Audit.NET (>= 30.0.2)
- ImmuDB4Net (>= 1.0.5)
-
net6.0
- Audit.NET (>= 30.0.2)
- ImmuDB4Net (>= 1.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.