serilog-sinks-elasticsearch
serilog-sinks-elasticsearch copied to clipboard
Issues with connection to elasticsearch are not visible in logs
"Serilog.Sinks.Elasticsearch" Version="8.4.1" Elasticsearch image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 <TargetFramework>net6.0</TargetFramework>
Configuration: .WriteTo.Elasticsearch(new(new Uri(elkUrl)) { AutoRegisterTemplate = true, IndexFormat = $"{appName.ToLower().Replace(".", "-")}-{environment.ToLower().Replace(".", "-")}-{DateTime.UtcNow:yyyy-MM}" })
Description:
I had issues with connection to elastic (lack of credentials). When I connected to pod logs, there was NO into about connection issues to elastic.
Solution: Logs about connection issues must be visible in pod logs by default. Please, if additional cfg is needed, provide info. Thanks
You need to set the EmitEventFailure option, and further, make sure the Serilog self logger is configured, for example
Serilog.Debugging.SelfLog.Enable(msg => Console.WriteLine(msg));