elastic / elastic/ecs-dotnet

Where is `WithEcsHttpContext` defined and how to put this in `appsettings.json` `"Enrich"` configuration?

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

Description

I am using `Elastic.CommonSchema.Serilog` `8.12.3` and get the following build error:
```
'LoggerEnrichmentConfiguration' does not contain a definition for 'WithEcsHttpContext' and no accessible extension method 'WithEcsHttpContext' accepting a first argument of type 'LoggerEnrichmentConfiguration' could be found (are you missing a using directive or an assembly reference?)
```

How to put the following
```
config.ReadFrom.Configuration(ctx.Configuration).Enrich.WithEcsHttpContext(ctx.Configuration.Get());
```
into `appsettings.json` `"Enrich"` configuration?
```
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
],
```
Is the following `appsettings.json` still relevant with the latest development in ElasticSearch JSON formatter?
```
"WriteTo": [
{
"Name": "File",
"Args": {
"Args": {
"outputTemplate": "{Timestamp} {Level} {EventId} {Message:j} {Properties}{NewLine}{Exception}{NewLine}"
},
"Enrich": [
"FromLogContext"
],
"path": "/var/log/aspnetcore/log",
"rollingInterval": "Day",
"retainedFileCountLimit": 3,
"formatter": "Serilog.Formatting.Elasticsearch.ElasticsearchJsonFormatter, Serilog.Formatting.Elasticsearch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10"
}
}
]
```
If not, how should I change it to?

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.