serilog-sinks-elasticsearch icon indicating copy to clipboard operation
serilog-sinks-elasticsearch copied to clipboard

The serilog-events-template index pattern doesn't match the index name

Open MahmoudSamir101 opened this issue 2 years ago • 0 comments

A few questions before you begin:

Is this an issue related to the Serilog core project or one of the sinks or community projects.
This issue list is intended for Serilog Elasticsearch Sink issues. If this issue relates to another sink or to the code project, please log on the related repository. Please use Gitter chat and Stack Overflow for discussions and questions.

Does this issue relate to a new feature or an existing bug?

  • [x] Bug
  • [ ] New Feature

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.

  • [x] Serilog.Sinks.Elasticsearch, v8.4.1

What is the target framework and operating system? See target frameworks & net standard matrix.

  • [x] .net 6.0
  • [ ] netCore 2.0
  • [ ] netCore 1.0

Please describe the current behavior?

When the IndexFormat contains capital letters such as Test-{0:yyyy-MM-dd} , the serilog-events-template is created with index pattern Test.* and the index is created with the name test-2022-10-08,

which results in the index not being created based on the index template settings and settings such as the number of shards or replicas are ignored.

Please describe the expected behavior? The serilog-events-template index pattern should match the index name, the index pattern can be lowercase to match the index name

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem

builder.Host.UseSerilog((context, services, configuration)
    => configuration.WriteTo.Console()
    .WriteTo.Elasticsearch(new ElasticsearchSinkOptions()
    {
        IndexFormat = $"Test-{{0:yyyy-MM-dd}}",
        AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
        AutoRegisterTemplate = true,
        OverwriteTemplate = true,
        NumberOfReplicas = 10,
        NumberOfShards = 10
    }));  

Kibana

Screenshot 2022-10-08 154312

Screenshot 2022-10-08 154400

Screenshot 2022-10-08 154129

Screenshot 2022-10-08 154442

Elasticsearch Logs

elk

MahmoudSamir101 avatar Oct 08 '22 13:10 MahmoudSamir101