English 中文(简体)
Roll over index with elastic search and serilog
原标题:

We are using es 6.7 and serilog 7.1 in our dotnet core application.

In our logger implementation vi are using the following index "app-{0:yyyy.MM}-1" for our ElasticsearchSinkOptions.

This creates an index called app-2019.04-1 as expected.

However we set up an alias and a lifecycle policy which do a roll over action and creates a new index called app-2019.04-000002 after some conditions have been met - as expected.

The issue is that our dot net core application still logs to the first index app-2019.04-1 . How do we update the index format being used in the dot net core application when elastic search has performed a roll over action?

问题回答

Well I figure it out. Maybe it will help someone else. I had to log it to the alias and not the index.

For making it work you need to:

  1. Create an index with format xxxx-1
  2. Create an alias and ad it to the index e.g. xxxx
  3. Create index pattern xxxx-*
  4. Create lifecycle policy
  5. Create template with indexpattern, alias and lifecycle policy
  6. Make sure your indexformat in serilog is the alias.

Start logging :)





相关问题
Blazor Server App : Unable to unprotect the message.State

I am getting an Exception as above in my Blazor server application. Below is my Program.cs File builder.Services.AddAuthentication(AzureADB2CDefaults.BearerAuthenticationScheme) .AddOpenIdConnect(...

System Text JsonSerializer Deserialization of TimeSpan

In researching how to deserialize a TimeSpan using Newtonsoft s JSON.net I came across code in my current project that did not use Json.net. It used System.Text.Json.JsonSerializer and appeared to not ...

TCP Connection Creation and Closing Event Hooking [closed]

What helper classes C# provides to monitor all TCP connection on an OS. A piece of Sample code would also be appreciated. Note: Original intent was to monitor this on Windows but would be nice to do ...

热门标签