Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Integrate Elasticsearch.CommonSchema.Serilog text formatter #494

@nenadvicentic

Description

@nenadvicentic

A few questions before you begin:

Is this an issue related to the Serilog core project or one of the sinks or
community projects.
This issue list is intended for Serilog Elasticsearch Sink issues. If this issue relates to another sink or to the code project,
please log on the related repository. Please use Gitter chat and Stack Overflow for discussions and questions.

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

  • Bug
  • New Feature

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.
9.0.0-alpha-*

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

  • net 7.0
  • net 6.0
  • 4.8

As a part of integration effort between .NET and Elasticsearch, Elastic team provides Elastic Common Schema .NET repository which includes two sub-projects:

The issue is a follow-up to #254 and #227, containing more up-to-date information and first look at the integration.

Simple experiment with naïve Serilog.Sinks.Elasticsearch integration, where EcsTextFormatter simply replaces current default formater ElasticsearchJsonFormatter:

public static ITextFormatter CreateDefaultFormatter(ElasticsearchSinkOptions options)
{
    //return new ElasticsearchJsonFormatter(
    //    formatProvider: options.FormatProvider,
    //    closingDelimiter: string.Empty,
    //    serializer: options.Serializer != null ? new SerializerAdapter(options.Serializer) : null,
    //    inlineFields: options.InlineFields,
    //    formatStackTraceAsArray: options.FormatStackTraceAsArray
    //);

    return new EcsTextFormatter();
}

...produces following output in Elasticsearch/Kibana v8.6.0:

image

Open questions would be:

  • What would be minimal acceptable implementation (e.g. default EcsTextFormatter settings work just fine with Elasticsearch, using dynamic fields mapping, without any template registration)? Full implementation, with parity of features is something that would probably take a lot of rewrite effort and testing.
  • What to do with existing formatters? Should they be supported side-by-side (at least for the moment)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions