Hi,
I am using elasticsearch-5.0.0-alpha5 and trying to write to ElasticSearch using the latest Serilog.Sinks.Elasticsearch.ElasticsearchSink, however, I'm getting a 403 exception (see below).
My setup code is
var options = new ElasticsearchSinkOptions(new Uri("http://localhost:9200"));
options.AutoRegisterTemplate = true;
options.ModifyConnectionSettings = x => x.BasicAuthentication("kibana", "changeme");
Serilog.Debugging.SelfLog.Enable(msg => Debug.WriteLine(msg));
Log.Logger = new LoggerConfiguration()
.WriteTo.Elasticsearch(options)
.WriteTo.Seq("http://localhost:5341")
.ReadFrom.Configuration(Configuration)
.CreateLogger();
I'm new to ElasticSearch so any help would be greatly appreciated.
Exception
2016-09-22T21:54:15.1932498Z Exception while emitting periodic batch from Serilog.Sinks.Elasticsearch.ElasticsearchSink: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData)
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.BadResponse[TReturn](ElasticsearchResponse1& response, RequestData data, List
1 pipelineExceptions)
at Elasticsearch.Net.Transport1.Request[TReturn](HttpMethod method, String path, PostData
1 data, IRequestParameters requestParameters)
at Elasticsearch.Net.ElasticLowLevelClient.Bulk[T](PostData1 body, Func
2 requestParameters)
at Serilog.Sinks.Elasticsearch.ElasticsearchSink.EmitBatchChecked[T](IEnumerable`1 events)
at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.OnTick()