serilog / serilog-settings-configuration

A Serilog configuration provider that reads from Microsoft.Extensions.Configuration
Apache License 2.0
456 stars 129 forks source link

Args String Array Support. #296

Open RiddlerKnight opened 2 years ago

RiddlerKnight commented 2 years ago

I try to use string[] in Args section but the values is not map to the config option.

"WriteTo":[
     {
        "Name": "Elasticsearch",
        "Args": {
               "indexAliases": ["logstash"]
         }
     }
]

Serilog.Settings.Configuration 3.3.0

0xced commented 1 year ago

The Serilog.Sinks.Elasticsearch sink is configured through an ElasticsearchSinkOptions options parameter. So this is how it must be configured (i.e. with an intermediate options object):

"WriteTo": [
  {
    "Name": "Elasticsearch",
    "Args": {
      "options": {
        "indexAliases": [ "logstash" ]
      }
    }
  }
]