elastic / elastic/ecs-dotnet

[FEATURE] Support passing prepared EcsDocument object to the logging API

Open
#351 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
HTML
Stars
137
Forks
70
PR merge metrics
No merged PRs in 30d

Description

**ECS integration/library project**: Elastic.CommonSchema.Serilog

**Is your feature request related to a problem? Please describe.**
The current implementation of _Elastic.CommonSchema.Serilog_ only supports generating `EcsDocument` objects on the fly from a message template. That however means that every property I want modified in the output `EcsDocument` object needs to be present in the message template. While this works great for simple `EcsDocument` objects, it doesn't scale well when I need to:
* modify a lot properties in the generated `EcsDocument` object
* include non-ECS properties that I want to have outside the `$.metadata` dictionary

**Describe the solution you'd like**
In addition to accepting MEL message template with known template properties to manipulate the generated `EcsDocument` (as shown [here](https://www.elastic.co/guide/en/ecs-logging/dotnet/current/serilog-formatter.html#_ecs_aware_message_templates_2)), I would like to be able to pass prepared `EcsDocument` object to the logging API and have _Elastic.CommonSchema.Serilog_ library serialize it as JSON into Serilog.

Optionally (when configured so), I would also like _Elastic.CommonSchema.Serilog_ to enrich the prepared `EcsDocument` object with contextual data like:
* source file path
* source file line
* method name
* [Host fields](https://www.elastic.co/guide/en/ecs/current/ecs-host.html)
* [Process fields](https://www.elastic.co/guide/en/ecs/current/ecs-process.html)
* etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.