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

Enable configuration of IndexDecider also from a config file

Open kbalys opened this issue 1 year ago • 0 comments
trafficstars

New feature request

Please describe the current behavior?

Currently IndexDecider setting can be set only from code.

public Func<LogEvent, DateTimeOffset, string> IndexDecider { get; set; }

I would like to have a possibility to set IndexDecider from configuration as well.

Please describe the expected behavior? LoggerConfigurationElasticsearchExtensions.Elasticsearch should be changed to include IndexDecider as well which can be a string in class name, assembly format. Additionally, we would need an interface or base class which can be used for this setting with a single property which matches the definition of IndexDecider. The code in LoggerConfigurationElasticsearchExtensions.Elasticsearch can activate the class name provided by configuration and assign its property to the options.IndexDecider property

kbalys avatar Feb 01 '24 11:02 kbalys