Serilog via Elasticsearch

110 views Asked by At

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
        });
  1. When logs like this _logger.LogInformation("{geo.name}", "Land of Oz") then field in kibana is geo.name but when using like this _logger.LogInformation("{client.geo.name}", "Land of Oz") then field in kibana is fields.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 as fields.* and it is ok?

  2. 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.

0

There are 0 answers