I wanted to leave a suggestion because i wasted FAR too many hours trying to find a way to do it and it was right in front of me. You recommend the following for Serilog
const string esUrl = "https://aws-es-thinger.us-west-1.es.amazonaws.com";
Log.Logger = new LoggerConfiguration()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(esUrl))
{
ModifyConnectionSettings = conn =>
{
var httpConnection = new AwsHttpConnection("us-east-1");
var pool = new SingleNodeConnectionPool(new Uri(esUrl));
return new ConnectionConfiguration(pool, httpConnection);
}
})
.CreateLogger();
This works and is fine, but doesn't allow for Configuration-based setup to be used. I would recommend the following which would also allow for people who use appSettings.json as their method for loading
const string esUrl = "https://aws-es-thinger.us-west-1.es.amazonaws.com";
Log.Logger = new LoggerConfiguration()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(esUrl))
{
Connection = new AwsHttpConnection()
})
.CreateLogger();
I wanted to leave a suggestion because i wasted FAR too many hours trying to find a way to do it and it was right in front of me. You recommend the following for Serilog
This works and is fine, but doesn't allow for Configuration-based setup to be used. I would recommend the following which would also allow for people who use appSettings.json as their method for loading
In the Serilog configuration you can now do this: