Dot-Net
Serilog + serilog-sinks-elasticsearch + ElasticSearch Auth
我遠不是一個有任何 .net 經驗的開發人員,但工作中的開發團隊希望使用 Serilog 和 serilog-sinks-elasticsearch 將日誌推送到我的 ELK 堆棧中。
查看 serilog-sinks-elasticsearch 的配置,似乎沒有任何方法可以發送寫入 ElasticSearch 集群所需的憑據。
這只是一個愚蠢的操作人員問題還是我只是在某個地方錯過了配置?
謝謝
我也很難找到一個好的解決方案。將使用者名/密碼添加到 url 確實有效,但不知何故感覺不對。
這對我有用:
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri("https://your-deployment.westeurope.azure.elastic-cloud.com:9243")) { ..., ModifyConnectionSettings = x => x.BasicAuthentication("elastic", "your-password"), })
好問題….
您可以嘗試將它們作為 Elasticsearch 伺服器/堆棧 URL 的一部分提供。
例子:
.WriteTo.Sink(new ElasticsearchSink(new ElasticsearchSinkOptions(new Uri(url)) { AutoRegisterTemplate = true }在哪裡
url = "https://user:password@stack-server:port"