Audit.NET.Redis
25.0.5
See the version list below for details.
dotnet add package Audit.NET.Redis --version 25.0.5
NuGet\Install-Package Audit.NET.Redis -Version 25.0.5
<PackageReference Include="Audit.NET.Redis" Version="25.0.5" />
paket add Audit.NET.Redis --version 25.0.5
#r "nuget: Audit.NET.Redis, 25.0.5"
// Install Audit.NET.Redis as a Cake Addin #addin nuget:?package=Audit.NET.Redis&version=25.0.5 // Install Audit.NET.Redis as a Cake Tool #tool nuget:?package=Audit.NET.Redis&version=25.0.5
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 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. |
.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 is compatible. 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.2
- Audit.NET (>= 25.0.5)
- StackExchange.Redis (>= 2.7.10)
-
.NETStandard 2.0
- Audit.NET (>= 25.0.5)
- StackExchange.Redis (>= 2.7.10)
-
net6.0
- Audit.NET (>= 25.0.5)
- StackExchange.Redis (>= 2.7.10)
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 |
---|---|---|
26.0.1 | 93 | 8/22/2024 |
26.0.0 | 73 | 7/19/2024 |
25.0.7 | 98 | 7/4/2024 |
25.0.6 | 85 | 6/24/2024 |
25.0.5 | 95 | 6/18/2024 |
25.0.4 | 1,653 | 3/24/2024 |
25.0.3 | 119 | 3/13/2024 |
25.0.2 | 105 | 3/12/2024 |
25.0.1 | 112 | 2/28/2024 |
25.0.0 | 1,015 | 2/16/2024 |
24.0.1 | 115 | 2/12/2024 |
24.0.0 | 107 | 2/12/2024 |
23.0.0 | 1,058 | 12/14/2023 |
22.1.0 | 103 | 12/9/2023 |
22.0.2 | 131 | 12/1/2023 |
22.0.1 | 1,242 | 11/16/2023 |
22.0.0 | 211 | 11/14/2023 |
21.1.0 | 154 | 10/9/2023 |
21.0.4 | 2,013 | 9/15/2023 |
21.0.3 | 571 | 7/9/2023 |
21.0.2 | 142 | 7/6/2023 |
21.0.1 | 146 | 5/27/2023 |
21.0.0 | 213 | 4/15/2023 |
20.2.4 | 245 | 3/27/2023 |
20.2.3 | 242 | 3/17/2023 |
20.2.2 | 250 | 3/14/2023 |
20.2.1 | 249 | 3/11/2023 |
20.2.0 | 236 | 3/7/2023 |
20.1.6 | 275 | 2/23/2023 |
20.1.5 | 295 | 2/9/2023 |
20.1.4 | 4,369 | 1/28/2023 |
20.1.3 | 339 | 12/21/2022 |
20.1.2 | 325 | 12/14/2022 |
20.1.1 | 308 | 12/12/2022 |
20.1.0 | 346 | 12/4/2022 |
20.0.4 | 360 | 11/30/2022 |
20.0.3 | 2,544 | 10/28/2022 |
20.0.2 | 439 | 10/26/2022 |
20.0.1 | 479 | 10/21/2022 |
20.0.0 | 1,591 | 10/1/2022 |
19.4.1 | 1,175 | 9/10/2022 |
19.4.0 | 491 | 9/2/2022 |
19.3.0 | 477 | 8/23/2022 |
19.2.2 | 2,084 | 8/11/2022 |
19.2.1 | 501 | 8/6/2022 |
19.2.0 | 1,413 | 7/24/2022 |
19.1.4 | 3,376 | 5/23/2022 |
19.1.3 | 477 | 5/22/2022 |
19.1.2 | 476 | 5/18/2022 |
19.1.1 | 849 | 4/28/2022 |
19.1.0 | 591 | 4/10/2022 |
19.0.7 | 3,544 | 3/13/2022 |
19.0.6 | 562 | 3/7/2022 |
19.0.5 | 995 | 1/28/2022 |
19.0.4 | 544 | 1/23/2022 |
19.0.3 | 3,441 | 12/14/2021 |
19.0.2 | 391 | 12/11/2021 |
19.0.1 | 832 | 11/20/2021 |
19.0.0 | 420 | 11/11/2021 |
19.0.0-rc.net60.2 | 164 | 9/26/2021 |
19.0.0-rc.net60.1 | 209 | 9/16/2021 |
18.1.6 | 741 | 9/26/2021 |
18.1.5 | 509 | 9/7/2021 |
18.1.4 | 440 | 9/6/2021 |
18.1.3 | 479 | 8/19/2021 |
18.1.2 | 536 | 8/8/2021 |
18.1.1 | 484 | 8/5/2021 |
18.1.0 | 487 | 8/1/2021 |
18.0.1 | 521 | 7/30/2021 |
18.0.0 | 516 | 7/26/2021 |
17.0.8 | 524 | 7/7/2021 |
17.0.7 | 499 | 6/16/2021 |
17.0.6 | 482 | 6/5/2021 |
17.0.5 | 483 | 5/28/2021 |
17.0.4 | 469 | 5/4/2021 |
17.0.3 | 445 | 5/1/2021 |
17.0.2 | 482 | 4/22/2021 |
17.0.1 | 447 | 4/18/2021 |
17.0.0 | 509 | 3/26/2021 |
16.5.6 | 467 | 3/25/2021 |
16.5.5 | 453 | 3/23/2021 |
16.5.4 | 491 | 3/9/2021 |
16.5.3 | 441 | 2/26/2021 |
16.5.2 | 463 | 2/23/2021 |
16.5.1 | 482 | 2/21/2021 |
16.5.0 | 485 | 2/17/2021 |
16.4.5 | 471 | 2/15/2021 |
16.4.4 | 460 | 2/5/2021 |
16.4.3 | 468 | 1/27/2021 |
16.4.2 | 505 | 1/22/2021 |
16.4.1 | 520 | 1/21/2021 |
16.4.0 | 497 | 1/11/2021 |
16.3.3 | 550 | 1/8/2021 |
16.3.2 | 514 | 1/3/2021 |
16.3.1 | 542 | 12/31/2020 |
16.3.0 | 501 | 12/30/2020 |
16.2.1 | 477 | 12/27/2020 |
16.2.0 | 530 | 10/13/2020 |
16.1.5 | 532 | 10/4/2020 |
16.1.4 | 568 | 9/17/2020 |
16.1.3 | 671 | 9/13/2020 |
16.1.2 | 565 | 9/9/2020 |
16.1.1 | 589 | 9/3/2020 |
16.1.0 | 564 | 8/19/2020 |
16.0.3 | 617 | 8/15/2020 |
16.0.2 | 606 | 8/9/2020 |
16.0.1 | 625 | 8/8/2020 |
16.0.0 | 557 | 8/7/2020 |
15.3.0 | 655 | 7/23/2020 |
15.2.3 | 575 | 7/14/2020 |
15.2.2 | 596 | 5/19/2020 |
15.2.1 | 586 | 5/12/2020 |
15.2.0 | 629 | 5/9/2020 |
15.1.1 | 624 | 5/4/2020 |
15.1.0 | 635 | 4/13/2020 |
15.0.5 | 608 | 3/18/2020 |
15.0.4 | 632 | 2/28/2020 |
15.0.3 | 609 | 2/26/2020 |
15.0.2 | 685 | 1/20/2020 |
15.0.1 | 646 | 1/10/2020 |
15.0.0 | 657 | 12/17/2019 |
14.9.1 | 643 | 11/30/2019 |
14.9.0 | 634 | 11/29/2019 |
14.8.1 | 648 | 11/26/2019 |
14.8.0 | 695 | 11/20/2019 |
14.7.0 | 649 | 10/9/2019 |
14.6.6 | 636 | 10/8/2019 |
14.6.5 | 640 | 9/27/2019 |
14.6.4 | 640 | 9/21/2019 |
14.6.3 | 681 | 8/12/2019 |
14.6.2 | 700 | 8/3/2019 |
14.6.1 | 700 | 8/3/2019 |
14.6.0 | 669 | 7/26/2019 |
14.5.7 | 676 | 7/18/2019 |
14.5.6 | 707 | 7/10/2019 |
14.5.5 | 661 | 7/1/2019 |
14.5.4 | 675 | 6/17/2019 |
14.5.3 | 710 | 6/5/2019 |
14.5.2 | 716 | 5/30/2019 |
14.5.1 | 697 | 5/28/2019 |
14.5.0 | 749 | 5/24/2019 |
14.4.0 | 728 | 5/22/2019 |
14.3.4 | 684 | 5/14/2019 |
14.3.3 | 697 | 5/9/2019 |
14.3.2 | 721 | 4/30/2019 |
14.3.1 | 715 | 4/27/2019 |
14.3.0 | 776 | 4/24/2019 |
14.2.3 | 709 | 4/17/2019 |
14.2.2 | 707 | 4/10/2019 |
14.2.1 | 689 | 4/5/2019 |
14.2.0 | 715 | 3/16/2019 |
14.1.1 | 735 | 3/8/2019 |
14.1.0 | 796 | 2/11/2019 |
14.0.4 | 812 | 1/31/2019 |
14.0.3 | 836 | 1/22/2019 |
14.0.2 | 852 | 12/15/2018 |
14.0.1 | 847 | 11/29/2018 |
14.0.0 | 891 | 11/19/2018 |
13.3.0 | 861 | 11/16/2018 |
13.2.2 | 862 | 11/15/2018 |
13.2.1 | 903 | 11/13/2018 |
13.2.0 | 887 | 10/31/2018 |
13.1.5 | 875 | 10/31/2018 |
13.1.4 | 881 | 10/25/2018 |
13.1.3 | 861 | 10/18/2018 |
13.1.2 | 971 | 9/12/2018 |
13.1.1 | 921 | 9/11/2018 |
13.1.0 | 916 | 9/11/2018 |
13.0.0 | 1,064 | 8/29/2018 |
12.3.6 | 991 | 8/29/2018 |
12.3.5 | 988 | 8/22/2018 |
12.3.4 | 979 | 8/21/2018 |
12.3.3 | 25,705 | 8/21/2018 |
12.3.2 | 988 | 8/20/2018 |
12.3.1 | 1,011 | 8/20/2018 |
12.3.0 | 1,004 | 8/20/2018 |
12.2.2 | 1,043 | 8/15/2018 |
12.2.1 | 1,034 | 8/9/2018 |
12.2.0 | 1,002 | 8/8/2018 |
12.1.11 | 995 | 7/30/2018 |
12.1.10 | 1,025 | 7/20/2018 |
12.1.9 | 1,111 | 7/10/2018 |
12.1.8 | 1,006 | 7/2/2018 |
12.1.7 | 1,101 | 6/7/2018 |
12.1.6 | 1,020 | 6/4/2018 |
12.1.5 | 1,084 | 6/2/2018 |
12.1.4 | 992 | 5/25/2018 |
12.1.3 | 1,208 | 5/16/2018 |
12.1.2 | 1,038 | 5/15/2018 |
12.1.1 | 1,160 | 5/14/2018 |
12.1.0 | 1,123 | 5/9/2018 |
12.0.7 | 1,191 | 5/5/2018 |
12.0.6 | 1,208 | 5/4/2018 |
12.0.5 | 1,143 | 5/3/2018 |
12.0.4 | 1,197 | 4/30/2018 |
12.0.3 | 1,210 | 4/30/2018 |
12.0.2 | 1,135 | 4/27/2018 |
12.0.1 | 1,035 | 4/25/2018 |
12.0.0 | 1,049 | 4/22/2018 |
11.2.0 | 1,084 | 4/11/2018 |
11.1.0 | 1,191 | 4/8/2018 |
11.0.8 | 1,163 | 3/26/2018 |
11.0.7 | 1,135 | 3/20/2018 |
11.0.6 | 1,112 | 3/7/2018 |
11.0.5 | 1,066 | 2/22/2018 |
11.0.4 | 1,148 | 2/14/2018 |
11.0.3 | 1,120 | 2/12/2018 |
11.0.2 | 1,128 | 2/9/2018 |
11.0.1 | 1,058 | 1/29/2018 |
11.0.0 | 1,121 | 1/15/2018 |
10.0.3 | 1,486 | 12/29/2017 |
10.0.2 | 1,131 | 12/26/2017 |
10.0.1 | 1,167 | 12/18/2017 |
10.0.0 | 1,127 | 12/18/2017 |
9.3.0 | 1,114 | 12/17/2017 |
9.2.0 | 1,087 | 12/17/2017 |
9.1.3 | 1,117 | 12/5/2017 |
9.1.2 | 1,097 | 11/27/2017 |
9.1.1 | 1,085 | 11/21/2017 |
9.1.0 | 1,086 | 11/21/2017 |
9.0.1 | 1,123 | 11/11/2017 |
9.0.0 | 1,145 | 11/10/2017 |
8.7.0 | 1,107 | 11/9/2017 |
8.6.0 | 1,088 | 11/9/2017 |
8.5.0 | 1,110 | 10/3/2017 |
8.4.0 | 1,111 | 10/3/2017 |
8.3.1 | 1,384 | 9/8/2017 |
8.3.0 | 1,126 | 9/8/2017 |
8.2.0 | 1,088 | 9/4/2017 |
8.1.0 | 1,134 | 8/22/2017 |
8.0.0 | 1,203 | 8/19/2017 |
7.1.3 | 1,122 | 8/14/2017 |
7.1.2 | 1,160 | 8/2/2017 |