Serilog unable to loginto elastic search

595 Views Asked by At

I have created a simple C# program. It configures serilog to use the elastic search sink as below

string url = "http://localhost:9200/";
var logger = new LoggerConfiguration()
            .WriteTo.LiterateConsole()
            .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(url)))
            .CreateLogger();
logger.Error("This is an error Message");

I can see the log in literate console but nothing in elastic search. Do I need to create and specify an Index in the elastic search sink options? What am I doing wrong here ?

1

There are 1 best solutions below

0
On BEST ANSWER

In my case it was because of an authentication issue after installing x-pack. I temporary disabled it by adding

xpack.security.enabled: false

in elasticsearch.yml and kibana.yml. After that it started working.