403 Exception when trying to write to ElasticSearch using ElasticsearchSink


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()

I'm new to ElasticSearch so any help would be greatly appreciated.


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, List1 pipelineExceptions)
at Elasticsearch.Net.Transport1.Request[TReturn](HttpMethod method, String path, PostData1 data, IRequestParameters requestParameters)
at Elasticsearch.Net.ElasticLowLevelClient.Bulk[T](PostData1 body, Func2 requestParameters)
at Serilog.Sinks.Elasticsearch.ElasticsearchSink.EmitBatchChecked[T](IEnumerable`1 events)
at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.OnTick()

It looks like this is related to Shield and perhaps the default username\pwd not having sufficient privileges. I have a default install and have not changed any config settings etc.

Could anyone point me in the right direction here?

Hi @thinkabout,

same answer as in Getting a 403 error when performing a get operation

Can you please mark all of your related tickets as resolved?