https://github.com/netcorext/serilog.sinks.queuing.redis
Write Serilog events to Redis Stream and store to Elasticsearch
https://github.com/netcorext/serilog.sinks.queuing.redis
elasticsearch redis serilog-sink
Last synced: 2 months ago
JSON representation
Write Serilog events to Redis Stream and store to Elasticsearch
- Host: GitHub
- URL: https://github.com/netcorext/serilog.sinks.queuing.redis
- Owner: NETCOREXT
- License: mit
- Created: 2022-01-04T11:11:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T08:05:50.000Z (about 3 years ago)
- Last Synced: 2025-10-03T03:21:18.993Z (9 months ago)
- Topics: elasticsearch, redis, serilog-sink
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.Queuing.Redis
[](https://www.nuget.org/packages/Serilog.Sinks.Queuing.Redis)
Write Serilog events to Redis Stream and store them in Elasticsearch
---
## Example for ASP.NET 6
### Step 1
Add package reference
```
dotnet add package Serilog.Sinks.Queuing.Redis.ElasticHook
```
### Step 2
Configure Logging in Program.cs
```
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddElasticRedisStreamHook((provider, options) =>
{
options.ElasticsearchHost = "http://localhost:9200";
options.ApiKey = "foo bar";
options.Index = "log-";
options.IndexFormatPattern = "yyyyMMdd";
});
builder.Services.AddRedisQueuingSink((provider, options) =>
{
options.RedisConnectionString = "127.0.0.1:6379";
options.StreamKey = "logging";
options.NotificationChannel = "logging";
});
builder.ConfigureLogging((context, builder) =>
{
builder.ClearProviders();
builder.AddSerilog();
})
.UseSerilog((ctx, provider, lc) =>
{
var redisQueuingSinkOptions = provider.GetRequiredService();
lc.ReadFrom.Configuration(ctx.Configuration)
.Enrich.FromLogContext()
.WriteTo.RedisQueuingSink(redisQueuingSinkOptions);
});
```