-
Notifications
You must be signed in to change notification settings - Fork 19
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
Provide possibility to set Splunk meta-data field 'host' dynamically #80
Comments
I am sorry, this should be added to the Arc4u project and not Guidance. |
I have no clue why this was marked as a bug instead of an enhancement, as I have had selected the "new feature" template, but do you have any progress or ideas to share on that? Thanks. |
migrating to seq is the target so this wont be done. |
What a pity. Splunk is very common in use and supporting this would be a big plus, but up to you guys as product team. |
Is your feature request related to a problem? Please describe.
In our project we use the Serilog Splunk sink to ingest log messages into Splunk.
Unfortunately we noticed the message's meta-data field
host
was not set properly. As this field's value should contain the host machine name, it must be determined on runtime to avoid hard-coding it as the service/application will be deployed on many different servers.This issue was already addressed in the serilog-contrib/serliog-sinks-splunk issue backlog:
Describe the solution you'd like
The best solution we can get is that the Serilog sink used supports this.
If they don't implement this like requested in following issue, we can contribute and implement this by our own.
Describe alternatives you've considered
Until this is supported by the extension used, a workaround can be applied like following.
After the configuration (
appsettings.json
) is loaded in memory, it can be extended by the needed information. To do so we have to check if a Splunk ingest configuration exists. Only if a Splunk configuration exist, the meta-data fieldhost
should be added or overwritten in the memory hold configuration.Only after that the
Logger
object can be created by utilizing the in memory stored configuration.This should be already auto generated by the Guidance on project creation.
Workaround (implementation example)
Unfortunately this approach contains hard-coded JSON configuration paths as at point in time this was implemented we were in a rush and needed an implementation. Hence it would be awesome to determine those paths dynamically.
Please find the following workaround as code files in the attachements.
Within the
Startup.cs
Used extension methods from
ConfigurationExtensions.cs
Attachements
Workaround-serilog-sinks-splunk_host-field.zip
The text was updated successfully, but these errors were encountered: