Audit.NET.Redis
22.0.1
See the version list below for details.
dotnet add package Audit.NET.Redis --version 22.0.1
NuGet\Install-Package Audit.NET.Redis -Version 22.0.1
<PackageReference Include="Audit.NET.Redis" Version="22.0.1" />
paket add Audit.NET.Redis --version 22.0.1
#r "nuget: Audit.NET.Redis, 22.0.1"
// Install Audit.NET.Redis as a Cake Addin #addin nuget:?package=Audit.NET.Redis&version=22.0.1 // Install Audit.NET.Redis as a Cake Tool #tool nuget:?package=Audit.NET.Redis&version=22.0.1
Audit.NET.Redis
Redis storage provider for Audit.NET library (An extensible framework to audit executing operations in .NET).
Store the audit events in a Redis database as Strings, List, SortedSet, Hash, publish to a PubSub channel or add to a Redis Stream.
Install
NuGet Package To install the package run the following command on the Package Manager Console:
PM> Install-Package Audit.NET.Redis
Usage
Please see the Audit.NET Readme
Configuration
To set the Redis data provider globally, use the fluent configuration API, for example:
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString(RedisCnnString)
.AsString(str => str
.Key(ev => $"{Guid.NewGuid()}")));
If you need to set different providers/configuration per scope, you can use the RedisDataProviderHelper
to easily get a new Redis Data Provider via the fluent API, for example:
var dp = new RedisDataProviderHelper(RedisCnnString)
.AsString(str => str
.Key(ev => $"{Guid.NewGuid()}"));
using (AuditScope.Create(new AuditScopeOptions() { DataProvider = dp }))
{
// ...
}
Common settings
ConnectionString
indicates the redis connection string, based on StackExchange.Redis configuration.ConfigurationOptions
indicates the redis connection configuration options, when you need to provide custom connection options. Alternative to ConnectionString.Serializer
indicates a custom serialization method for the audit events. By default the events are serialized as JSON encoded as UTF-8.
Modes
This data provider allows to store the events in different ways.
Redis String
Store each audit event as a redis string.
Setup sample:
// Store audits as strings.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString("localhost:6379,allowAdmin=true")
.AsString(str => str
.Key(ev => $"{ev.EventType}:{Guid.NewGuid()}")));
Mandatory settings
- Use the
Key
method to indicate the redis key where the event will be stored, this key can depend on theAuditEvent
object.
Optional settings
TimeToLive
specifies the Time To Live for the Redis Key. Default is no TTL.Database
specifies the database ID to use. Default is database 0.AttachTask
attaches an additional redis command to the execution.
Redis Stream
Adds each audit event to a Redis Stream.
Setup sample:
// Store audits as strings.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString("localhost")
.AsStream(stream => stream
.Key("MyAuditStream")
.MaxLength(5000)
.WithCustomField("Date", ev => DateTime.UtcNow.ToString())));
Mandatory settings
- Use the
Key
method to indicate the stream redis key, this key can depend on theAuditEvent
object.
Optional settings
Database
specifies the database ID to use. Default is database 0.AttachTask
attaches an additional redis command to the execution.MaxLength
specifies the maximum quantity of events that the stream will store. Older elements will be deleted. Default is NULL for no-limit.DefaultAuditEventFieldName
specifies the default field name that will contain the AuditEvent JSON representation in the stream entry. Default is "AuditEvent".WithCustomField
allows specifying custom fields to be stored in the stream entry. By default, only the field named "AuditEvent" is stored, containing the JSON representation of the Audit Event.
Redis Hash
Store each audit event as a field in a redis hash.
Setup sample:
// Store audits in hashes per each EventType.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString(RedisCnnString)
.AsHash(hash => hash
.Key(ev => $"{ev.EventType}")
.HashField(ev => $"{Guid.NewGuid()}")));
Mandatory settings:
Key
to indicate the redis key where the hash will be stored, this key can depend on theAuditEvent
object.HashField
to indicate the redis field inside the hash where the event will be stored.
Optional settings
TimeToLive
specifies the Time To Live for the Redis Hash. Default is no TTL.Database
specifies the database ID to use. Default is database 0.AttachTask
attaches an additional redis command to the execution.
Redis List
Store each audit event as a member in a redis list.
Setup sample:
// Store audits in lists per each EventType, with a maximum of 1000 events per list.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString(RedisCnnString)
.AsList(list => list
.Key(ev => $"{ev.EventType}")
.MaxLength(1000)));
Mandatory settings:
Key
to indicate the redis key where the list will be stored, this key can depend on theAuditEvent
object.
Optional settings:
MaxLength
to indicate the maximum quantity of events that the list will store. Older elements will be deleted. Default is no-limit.TimeToLive
specifies the Time To Live for the Redis List. Default is no TTL.Database
specifies the database ID to use. Default is database 0.AttachTask
attaches an additional redis command to the execution.
Redis Sorted Set
Store each audit event as a member in a redis sorted set.
Setup sample:
// Store audits in sorted sets per each EventType, maintaining only the events from the last 30 days.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString(RedisCnnString)
.AsSortedSet(sset => sset
.Key(ev => $"{ev.EventType}")
.Score(ev => ev.StartDate.Ticks)
.MinScore(ev => DateTime.UtcNow.AddDays(-30).Ticks)));
Mandatory settings:
Key
to indicate the redis key where the sorted set will be stored, this key can depend on theAuditEvent
object.Score
to indicate the score as adouble
that the event will have, can depend on theAuditEvent
object.
Optional settings:
MinScore
specifies a function that returns the minimum score allowed for the sorted set. Audits with score less than the minimum will be deleted. This deletion takes place when a new event is stored.MaxScore
specifies a function that returns the maximum score allowed for the sorted set.MaxRank
specifies a function that returns the maximum rank allowed for the sorted set. Max>0: Maintain only the top N scored elements. Max<0: Maintain only the bottom N scored elements.TimeToLive
specifies the Time To Live for the Redis Sorted Set. Default is no TTL.Database
specifies the database ID to use. Default is database 0.AttachTask
attaches an additional redis command to the execution.
Redis PubSub
Sends the audit events to a redis PubSub channel.
Setup sample:
// Send audits to PubSub channels.
Audit.Core.Configuration.Setup()
.UseRedis(redis => redis
.ConnectionString(RedisCnnString)
.AsPubSub(pub => pub
.Channel(ev => $"audits:{ev.EventType}")));
Mandatory settings:
Channel
to indicate the channel name to use for publishing the events.
Query events
This provider implements GetEvent
and GetEventAsync
methods to obtain an audit event by id:
var event = Configuration.DataProvider.GetEvent("eventId");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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. |
.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 is compatible. 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. |
-
.NETFramework 4.6.1
- Audit.NET (>= 22.0.1)
- StackExchange.Redis (>= 2.2.88)
-
.NETStandard 2.0
- Audit.NET (>= 22.0.1)
- StackExchange.Redis (>= 2.2.88)
-
net5.0
- Audit.NET (>= 22.0.1)
- StackExchange.Redis (>= 2.2.88)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
27.1.1 | 80 | 10/28/2024 |
27.1.0 | 75 | 10/24/2024 |
27.0.3 | 1,659 | 9/25/2024 |
27.0.2 | 93 | 9/19/2024 |
27.0.1 | 116 | 9/4/2024 |
27.0.0 | 102 | 9/3/2024 |
26.0.1 | 168 | 8/22/2024 |
26.0.0 | 91 | 7/19/2024 |
25.0.7 | 112 | 7/4/2024 |
25.0.6 | 99 | 6/24/2024 |
25.0.5 | 114 | 6/18/2024 |
25.0.4 | 2,542 | 3/24/2024 |
25.0.3 | 133 | 3/13/2024 |
25.0.2 | 122 | 3/12/2024 |
25.0.1 | 125 | 2/28/2024 |
25.0.0 | 1,038 | 2/16/2024 |
24.0.1 | 132 | 2/12/2024 |
24.0.0 | 112 | 2/12/2024 |
23.0.0 | 1,079 | 12/14/2023 |
22.1.0 | 118 | 12/9/2023 |
22.0.2 | 145 | 12/1/2023 |
22.0.1 | 1,256 | 11/16/2023 |
22.0.0 | 232 | 11/14/2023 |
21.1.0 | 176 | 10/9/2023 |
21.0.4 | 2,036 | 9/15/2023 |
21.0.3 | 586 | 7/9/2023 |
21.0.2 | 161 | 7/6/2023 |
21.0.1 | 167 | 5/27/2023 |
21.0.0 | 228 | 4/15/2023 |
20.2.4 | 264 | 3/27/2023 |
20.2.3 | 260 | 3/17/2023 |
20.2.2 | 269 | 3/14/2023 |
20.2.1 | 268 | 3/11/2023 |
20.2.0 | 250 | 3/7/2023 |
20.1.6 | 286 | 2/23/2023 |
20.1.5 | 308 | 2/9/2023 |
20.1.4 | 4,382 | 1/28/2023 |
20.1.3 | 357 | 12/21/2022 |
20.1.2 | 338 | 12/14/2022 |
20.1.1 | 326 | 12/12/2022 |
20.1.0 | 361 | 12/4/2022 |
20.0.4 | 373 | 11/30/2022 |
20.0.3 | 2,555 | 10/28/2022 |
20.0.2 | 454 | 10/26/2022 |
20.0.1 | 492 | 10/21/2022 |
20.0.0 | 1,609 | 10/1/2022 |
19.4.1 | 1,188 | 9/10/2022 |
19.4.0 | 503 | 9/2/2022 |
19.3.0 | 490 | 8/23/2022 |
19.2.2 | 2,096 | 8/11/2022 |
19.2.1 | 513 | 8/6/2022 |
19.2.0 | 1,425 | 7/24/2022 |
19.1.4 | 3,390 | 5/23/2022 |
19.1.3 | 498 | 5/22/2022 |
19.1.2 | 492 | 5/18/2022 |
19.1.1 | 861 | 4/28/2022 |
19.1.0 | 603 | 4/10/2022 |
19.0.7 | 3,558 | 3/13/2022 |
19.0.6 | 582 | 3/7/2022 |
19.0.5 | 1,007 | 1/28/2022 |
19.0.4 | 563 | 1/23/2022 |
19.0.3 | 3,459 | 12/14/2021 |
19.0.2 | 403 | 12/11/2021 |
19.0.1 | 844 | 11/20/2021 |
19.0.0 | 435 | 11/11/2021 |
19.0.0-rc.net60.2 | 169 | 9/26/2021 |
19.0.0-rc.net60.1 | 214 | 9/16/2021 |
18.1.6 | 773 | 9/26/2021 |
18.1.5 | 530 | 9/7/2021 |
18.1.4 | 457 | 9/6/2021 |
18.1.3 | 509 | 8/19/2021 |
18.1.2 | 548 | 8/8/2021 |
18.1.1 | 496 | 8/5/2021 |
18.1.0 | 499 | 8/1/2021 |
18.0.1 | 533 | 7/30/2021 |
18.0.0 | 533 | 7/26/2021 |
17.0.8 | 540 | 7/7/2021 |
17.0.7 | 511 | 6/16/2021 |
17.0.6 | 503 | 6/5/2021 |
17.0.5 | 495 | 5/28/2021 |
17.0.4 | 485 | 5/4/2021 |
17.0.3 | 457 | 5/1/2021 |
17.0.2 | 494 | 4/22/2021 |
17.0.1 | 464 | 4/18/2021 |
17.0.0 | 519 | 3/26/2021 |
16.5.6 | 487 | 3/25/2021 |
16.5.5 | 465 | 3/23/2021 |
16.5.4 | 501 | 3/9/2021 |
16.5.3 | 453 | 2/26/2021 |
16.5.2 | 475 | 2/23/2021 |
16.5.1 | 497 | 2/21/2021 |
16.5.0 | 509 | 2/17/2021 |
16.4.5 | 487 | 2/15/2021 |
16.4.4 | 472 | 2/5/2021 |
16.4.3 | 484 | 1/27/2021 |
16.4.2 | 517 | 1/22/2021 |
16.4.1 | 532 | 1/21/2021 |
16.4.0 | 509 | 1/11/2021 |
16.3.3 | 576 | 1/8/2021 |
16.3.2 | 529 | 1/3/2021 |
16.3.1 | 554 | 12/31/2020 |
16.3.0 | 518 | 12/30/2020 |
16.2.1 | 489 | 12/27/2020 |
16.2.0 | 533 | 10/13/2020 |
16.1.5 | 545 | 10/4/2020 |
16.1.4 | 580 | 9/17/2020 |
16.1.3 | 691 | 9/13/2020 |
16.1.2 | 584 | 9/9/2020 |
16.1.1 | 592 | 9/3/2020 |
16.1.0 | 577 | 8/19/2020 |
16.0.3 | 630 | 8/15/2020 |
16.0.2 | 619 | 8/9/2020 |
16.0.1 | 638 | 8/8/2020 |
16.0.0 | 573 | 8/7/2020 |
15.3.0 | 677 | 7/23/2020 |
15.2.3 | 588 | 7/14/2020 |
15.2.2 | 609 | 5/19/2020 |
15.2.1 | 607 | 5/12/2020 |
15.2.0 | 640 | 5/9/2020 |
15.1.1 | 637 | 5/4/2020 |
15.1.0 | 655 | 4/13/2020 |
15.0.5 | 627 | 3/18/2020 |
15.0.4 | 651 | 2/28/2020 |
15.0.3 | 619 | 2/26/2020 |
15.0.2 | 699 | 1/20/2020 |
15.0.1 | 658 | 1/10/2020 |
15.0.0 | 669 | 12/17/2019 |
14.9.1 | 663 | 11/30/2019 |
14.9.0 | 646 | 11/29/2019 |
14.8.1 | 660 | 11/26/2019 |
14.8.0 | 707 | 11/20/2019 |
14.7.0 | 665 | 10/9/2019 |
14.6.6 | 648 | 10/8/2019 |
14.6.5 | 657 | 9/27/2019 |
14.6.4 | 666 | 9/21/2019 |
14.6.3 | 693 | 8/12/2019 |
14.6.2 | 720 | 8/3/2019 |
14.6.1 | 715 | 8/3/2019 |
14.6.0 | 685 | 7/26/2019 |
14.5.7 | 687 | 7/18/2019 |
14.5.6 | 724 | 7/10/2019 |
14.5.5 | 681 | 7/1/2019 |
14.5.4 | 687 | 6/17/2019 |
14.5.3 | 722 | 6/5/2019 |
14.5.2 | 736 | 5/30/2019 |
14.5.1 | 709 | 5/28/2019 |
14.5.0 | 761 | 5/24/2019 |
14.4.0 | 741 | 5/22/2019 |
14.3.4 | 699 | 5/14/2019 |
14.3.3 | 710 | 5/9/2019 |
14.3.2 | 734 | 4/30/2019 |
14.3.1 | 727 | 4/27/2019 |
14.3.0 | 797 | 4/24/2019 |
14.2.3 | 727 | 4/17/2019 |
14.2.2 | 724 | 4/10/2019 |
14.2.1 | 708 | 4/5/2019 |
14.2.0 | 727 | 3/16/2019 |
14.1.1 | 747 | 3/8/2019 |
14.1.0 | 810 | 2/11/2019 |
14.0.4 | 829 | 1/31/2019 |
14.0.3 | 855 | 1/22/2019 |
14.0.2 | 875 | 12/15/2018 |
14.0.1 | 861 | 11/29/2018 |
14.0.0 | 903 | 11/19/2018 |
13.3.0 | 880 | 11/16/2018 |
13.2.2 | 882 | 11/15/2018 |
13.2.1 | 923 | 11/13/2018 |
13.2.0 | 915 | 10/31/2018 |
13.1.5 | 890 | 10/31/2018 |
13.1.4 | 893 | 10/25/2018 |
13.1.3 | 879 | 10/18/2018 |
13.1.2 | 992 | 9/12/2018 |
13.1.1 | 940 | 9/11/2018 |
13.1.0 | 937 | 9/11/2018 |
13.0.0 | 1,080 | 8/29/2018 |
12.3.6 | 1,004 | 8/29/2018 |
12.3.5 | 1,009 | 8/22/2018 |
12.3.4 | 992 | 8/21/2018 |
12.3.3 | 25,723 | 8/21/2018 |
12.3.2 | 1,001 | 8/20/2018 |
12.3.1 | 1,029 | 8/20/2018 |
12.3.0 | 1,023 | 8/20/2018 |
12.2.2 | 1,062 | 8/15/2018 |
12.2.1 | 1,054 | 8/9/2018 |
12.2.0 | 1,021 | 8/8/2018 |
12.1.11 | 1,009 | 7/30/2018 |
12.1.10 | 1,038 | 7/20/2018 |
12.1.9 | 1,129 | 7/10/2018 |
12.1.8 | 1,028 | 7/2/2018 |
12.1.7 | 1,116 | 6/7/2018 |
12.1.6 | 1,039 | 6/4/2018 |
12.1.5 | 1,108 | 6/2/2018 |
12.1.4 | 1,011 | 5/25/2018 |
12.1.3 | 1,215 | 5/16/2018 |
12.1.2 | 1,064 | 5/15/2018 |
12.1.1 | 1,186 | 5/14/2018 |
12.1.0 | 1,150 | 5/9/2018 |
12.0.7 | 1,218 | 5/5/2018 |
12.0.6 | 1,230 | 5/4/2018 |
12.0.5 | 1,165 | 5/3/2018 |
12.0.4 | 1,211 | 4/30/2018 |
12.0.3 | 1,227 | 4/30/2018 |
12.0.2 | 1,156 | 4/27/2018 |
12.0.1 | 1,055 | 4/25/2018 |
12.0.0 | 1,064 | 4/22/2018 |
11.2.0 | 1,100 | 4/11/2018 |
11.1.0 | 1,208 | 4/8/2018 |
11.0.8 | 1,181 | 3/26/2018 |
11.0.7 | 1,149 | 3/20/2018 |
11.0.6 | 1,133 | 3/7/2018 |
11.0.5 | 1,089 | 2/22/2018 |
11.0.4 | 1,174 | 2/14/2018 |
11.0.3 | 1,144 | 2/12/2018 |
11.0.2 | 1,148 | 2/9/2018 |
11.0.1 | 1,074 | 1/29/2018 |
11.0.0 | 1,135 | 1/15/2018 |
10.0.3 | 1,507 | 12/29/2017 |
10.0.2 | 1,152 | 12/26/2017 |
10.0.1 | 1,183 | 12/18/2017 |
10.0.0 | 1,141 | 12/18/2017 |
9.3.0 | 1,131 | 12/17/2017 |
9.2.0 | 1,106 | 12/17/2017 |
9.1.3 | 1,131 | 12/5/2017 |
9.1.2 | 1,116 | 11/27/2017 |
9.1.1 | 1,100 | 11/21/2017 |
9.1.0 | 1,105 | 11/21/2017 |
9.0.1 | 1,150 | 11/11/2017 |
9.0.0 | 1,164 | 11/10/2017 |
8.7.0 | 1,129 | 11/9/2017 |
8.6.0 | 1,103 | 11/9/2017 |
8.5.0 | 1,123 | 10/3/2017 |
8.4.0 | 1,138 | 10/3/2017 |
8.3.1 | 1,406 | 9/8/2017 |
8.3.0 | 1,140 | 9/8/2017 |
8.2.0 | 1,109 | 9/4/2017 |
8.1.0 | 1,150 | 8/22/2017 |
8.0.0 | 1,219 | 8/19/2017 |
7.1.3 | 1,135 | 8/14/2017 |
7.1.2 | 1,183 | 8/2/2017 |