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 ?
In my case it was because of an authentication issue after installing x-pack. I temporary disabled it by adding
in elasticsearch.yml and kibana.yml. After that it started working.