ecs-dotnet icon indicating copy to clipboard operation
ecs-dotnet copied to clipboard

[BUG] When using the default data stream name, the value of IlmPolicy is ignored

Open urielginsburg opened this issue 2 years ago • 3 comments

ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog): Elastic.Serilog.Sinks

ECS schema version (e.g. 1.4.0): latest

ECS .NET assembly version (e.g. 1.4.2): latest

Elasticsearch version (if applicable): elastic cloud latest

.NET framework / OS: .net core 7.0 / ubuntu

Description of the problem, including expected versus actual behavior: when using WriteTo.Elasticsearch using the default datastream name, this uses 'logs' as the Type. The ILM policy gets defaulted to 'logs' even though a different name is specified in ElasticsearchSinkOptions.IlmPolicy.

Steps to reproduce:

  1. create 'test_ilm_policy in elastic manually, for example.
  2. Use the following code to configure the sink: loggerConfiguration.WriteTo.Elasticsearch(new[] { new Uri(elasticUrl) }, options => { options.BootstrapMethod = BootstrapMethod.Failure; options.IlmPolicy = "test_ilm_policy" } Expected result; a datastream called logs-dotnet-default is created and associated with the 'test_ilm_policy' policy. Actual result: a datastream called logs-dotnet-default is created and associated with the 'logs' policy

I imagine that this happens due to the logs-- default index pattern; this should be at least documented... Workaround - use a different "Type" part for the datastream name.

urielginsburg avatar Oct 18 '23 06:10 urielginsburg