Im trying to use a custom indexdecider to set the index name at run time for my serilog elasticsearch sink. (https://github.com/serilog/serilog-sinks-elasticsearch)
Whichever function I use for the index decider gets ignored and the index name defaults to logstash-yyyy-mm-dd unless I give it another index name pattern. I need it to use the index decider function.
var esConfig = new ElasticsearchSinkOptions(new Uri(elasticSearchLogServer))
{
BufferBaseFilename = Path.Combine(logPath, bufferfilename),
IndexDecider = (@event, offset) =>
{
var indexNumber = Math.Ceiling((double)offset.Day / 8);
var indexName = string.Format("{0}-{1}-{2}-{3:yyyy.MM}-{4}", "logbase", environment, shortAppname, offset, indexNumber);
return indexName;
}
};
var loggerConfiguration = loggerSinkConfiguration.Elasticsearch(esConfig);
This was a bug in the versions prior to 2.0.38
Simply update to a version of serilog-sinks-elasticsearch newer than 2.0.38.