8000 Where is `WithEcsHttpContext` defined and how to put this in `appsettings.json` `"Enrich"` configuration? · Issue #494 · elastic/ecs-dotnet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
khteh opened this issue Apr 20, 2025 · 0 comments

Comments

@khteh
Copy link
khteh commented Apr 20, 2025

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<HttpContextAccessor>());

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0