I use serilog to log some data and writes it to console and elasticsearch. ECS supports Geo. Geo can be nested under Client and Host. I use default serilog formatter on official site. So code example
EcsTextFormatterConfiguration ecsConfiguration = new()
{
...
};
EcsTextFormatter formatter = new(ecsConfiguration);
loggerConfiguration
.ReadFrom.Configuration(configuration)
//Some enrichers
//....
.WriteTo.Console(formatter)
.WriteTo.Elasticsearch(
new ElasticsearchSinkOptions(new Uri(elasticUrl))
{
CustomFormatter = formatter
});
When logs like this
_logger.LogInformation("{geo.name}", "Land of Oz")
then field in kibana isgeo.name
but when using like this_logger.LogInformation("{client.geo.name}", "Land of Oz")
then field in kibana isfields.client.geo.name
. And when uses some custom structured logging construction like '{customLable}' it puts into kibana as 'lables.customLable'. Does it mean that all known nested fields will be put into kibana asfields.*
and it is ok?Second question is - does exist complete enrichers for Client, Geo, Orchestrator and other fields presented here. Or its time to write own enrichers, with complex solution between front and back? :D. Yes I know about this and some usefull enrichers from nugetorg like entityframework, but its not enough.