You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have spent a few hours trying to find a solution to configure the Splunk EventCollector configuration in the appsettings.json file and resolve and set the host of the application on startup. Sadly I was not able to find an elegant solution.
Approach
Unfortunately I have not found a way that allows a combination of both configuration options.
Except that the EventCollector is completely redefined via code and the appsettings.json has to be accessed pretty statically. Surely this can be done a bit more elegantly, but it was just for testing here.
The before described code + configuration does the trick. The meta data field host is set properly with the machine name of the application's host. But it's more cumbersome than handy.
Suggestion
Therefore my suggestions for improvement:
Properties that are named just like meta data fields also override them and don't add them as a new property;
Allow placeholders in appsettings.json that are resolved on startup - like in log templates on event emit;
e.g.: host: "{machineName}"
Allow in a simple way to extend the already load appsettings.json configuration via code on logger creation;
The text was updated successfully, but these errors were encountered:
Hello,
This is a suggestion for improvement.
I have spent a few hours trying to find a solution to configure the Splunk EventCollector configuration in the
appsettings.json
file and resolve and set the host of the application on startup. Sadly I was not able to find an elegant solution.Approach
Unfortunately I have not found a way that allows a combination of both configuration options.
Except that the EventCollector is completely redefined via code and the
appsettings.json
has to be accessed pretty statically. Surely this can be done a bit more elegantly, but it was just for testing here.Configuration (just an extraction of it):
Quiet ugly code example:
The before described code + configuration does the trick. The meta data field
host
is set properly with the machine name of the application's host. But it's more cumbersome than handy.Suggestion
Therefore my suggestions for improvement:
appsettings.json
that are resolved on startup - like in log templates on event emit;host: "{machineName}"
appsettings.json
configuration via code on logger creation;The text was updated successfully, but these errors were encountered: