serilog-sinks-elasticsearch
serilog-sinks-elasticsearch copied to clipboard
configure basic auth from appsettings.json
to set basic auth from code I would use:
var options = new ElasticsearchSinkOptions(new Uri(elasticConnection)) { AutoRegisterTemplate = true, IndexFormat = $"{appSettings.ElasticPreIndex}_log_api-{0:yyyy.MM.dd}", options.ModifyConnectionSettings = (c) => c.BasicAuthentication(appSettings.ElasticBasicAuthUserName, appSettings.ElasticBasicAuthPassword) };
How is this possible to set this from appsettings.json.
Also, I tried to set all the other sinks (console, etc) from appsettings.json and then using both:
Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(config) .WriteTo.Elasticsaerch(options) .CreateLogger()
But only the settings from the .ReadFrom.... are applied.
I think that as workaround you can pass credentials for http basic auth via your node url.
The format is: http(s)://username:[email protected]:XXXX
I think that as workaround you can pass credentials for http basic auth via your node url. The format is:
http(s)://username:[email protected]:XXXX
brilliant it works for me
I think that as workaround you can pass credentials for http basic auth via your node url. The format is:
http(s)://username:[email protected]:XXXX
It looks like it works for a single node only, but not for several nodes separated by ; or ,
Hi all, I considering about user roles on ELK for Serilog. Which role is enough for logging ?
Thanks !
Elasticsearch has property connectionGlobalHeaders. You can use it by passing base64 encoded username:password pair like this
"connectionGlobalHeaders": "Authorization=Basic base64Encode(username:password)",