serilog-sinks-elasticsearch icon indicating copy to clipboard operation
serilog-sinks-elasticsearch copied to clipboard

Elasticsearch Sink Does Not Report Errors to the Selflog.

Open estoces opened this issue 5 years ago • 2 comments
trafficstars

A few questions before you begin:

Is this an issue related to the Serilog core project or one of the [sinks]

Serilog Elasticsearch Sink issue

Does this issue relate to a new feature or an existing bug?

  • [x] Bug
  • [ ] New Feature

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package. 8.0.1 and 8.1.0

What is the target framework and operating system? See target frameworks & net standard matrix.

  • [x] netCore 2.0
  • [ ] netCore 1.0
  • [ ] 4.7
  • [ ] 4.6.x
  • [ ] 4.5.x

Please describe the current behavior? Sink does not publish log entries to ElasticCloud/Kibana. SelfLog (console) is not outputting any issues.

Please describe the expected behavior? Errors would be reported to the SelfLog and written to the console if failure occurred when sending data to Elasticsearch/Kibana.

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem

I updated to 8.1.0 and log entries started failing to get to kibana. Ran locally to reproduce. No errors were being written to the console. Selflog was enables e.g. SelfLog.Enable(Console.Out);

Reverted back to 8.0.1 and ran and everything was good. Changed index to something invalid to see if the SelfLog would output errors. The log entries failed to make it to kibana and no error was reported to SelfLog.

estoces avatar Jul 02 '20 19:07 estoces

Same here.

suadev avatar Dec 02 '20 14:12 suadev

For me, it's not working even with 8.0.1. I am using it in the net core 3.1 version

return logs.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(uri)
            {
                FailureCallback = e => System.Console.WriteLine($"Unable to send logs to elasticsearch: {e.MessageTemplate} {e.Exception.Message} "),
                EmitEventFailure = EmitEventFailureHandling.RaiseCallback,
                AutoRegisterTemplate = true,
                AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,                
                IndexFormat = index,
                MinimumLogEventLevel = level
            });

I have added FailureCallback and also enable SelfLog.Enable(Console.WriteLine);

@estoces do you think I am missing something or is it because not compatible with .netcore 3.1?

nibro7778 avatar Sep 08 '21 13:09 nibro7778