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
[FEATURE] Enable full configuration of Elastic.Serilog.Sinks
through appsettings.json
#346
Comments
It seems like there is some support. I can tell at least that it will try to ship logs to elastic with default options if you include a Elasticsearch section in the WriteTo array. Is there anyway to tell what is currently supported? |
This is the only reason why we're not moving to |
This is really something essential for us too. |
fyi I've implemented a workaround: create a custom extension that works with appsettings.json
In my case, the need was just to configure the endpoint address. Since I was coming from
The discovery process of serilog, among other peculiarities, involves the extension be named like the sink (so Elasticsearch in this example) and be implemented in a project whose name contains "Serilog" OR the assembly name be included in the "Using" property under "Serilog" settings ( see https://github.com/serilog/serilog-settings-configuration?tab=readme-ov-file#using-section-and-auto-discovery-of-configuration-assemblies) Since my project haven't Serilog word in it, I used the "Using" like this In appsettings I had just to add nodeUris under "Args" property
and now my extension gets called, that just calls the original extension method accepting an Uri enumeration. So, while we wait for an official solution, we can create our own extension that fit our needs |
Serilog
supports full configuration of logging throughappsettings.json
viaSerilog.Settings.Configuration
NuGet package (project is here)For example
Serilog.Sinks.Elasticsearch
supports full configuration viaappsettings.json
. This would be an example:In
Serilog.Sinks.Elasticsearch
this is achieved by exposing extension method for configuration of each of input parameters. Int the code example bellow is simplified extension method, showing only two "Args" parameters used in above JSON configuration file.Full source code of the above extension method can be found here
The text was updated successfully, but these errors were encountered: