Lurgle.Logging now supports Splunk!
Lurgle.Logging until now has supported just the File, Windows Event Log, Seq, and Console log types. It was always the intent to extend this to other log types to support the overall intent of Lurgle - accelerating and enhancing structured logging in your projects by leveraging the excellent work of the Serilog community.
I hadn't got around to adding Splunk, because Seq fulfilled our needs for structured logging. I love Seq, but if you already have Splunk, you can readily send structured logs here via a HTTP Event Collector configured for Json. If you had both, you could send to both simultaneously!
This is really a straightforward addition. All it really took was to set up a Splunk instance on my machine for testing, and a small amount of code.
To make use of Splunk as a log type is just as easy. If you're using app.config, you can simply specify;
<add key="LogSplunkHost" value="https://splunk.domain.com/services/collector" />
<add key="LogSplunkToken" value="yourtokenhere" />
and of course via a constructor:
Logging.SetConfig(new LoggingConfig(Logging.Config, logSplunkHost: "https://splunk.domain.com/services/collector", logSplunkToken: "yourtokenhere"));
As with the other log types, there is a LogLevelSplunk setting that allows you to set the minimum log level for the Splunk sink.
I have set the Splunk sink to use the same proxy settings as Seq - so even if you don't use Seq, if you need to set proxy settings for your application to reach Splunk, use the LogSeqUseProxy, LogSeqProxyServer, etc, values.
This is available on Nuget now!
Comments