Adding a logging sink to server log

I’ve been looking into this a bit more the last few days and was able to come up with a solution.

I was able to get Kinetic to send logs from Serilog to Seq using hosting startup assemblies in ASP.NET Core . Note that this will only work for Kinetic versions using .NET Core!
This will essentially ‘sideload’ dependencies into the Kinetic app startup.
I used a custom sink wrapped around the Seq sink to parse out Exception messages and upgrade the LogLevel to Error.

Feel free to take this and build upon it for your use case. I would think you could use this for any other Serilog sinks.

Setup

  1. Build project with Serilog.Sinks.KineticSeqPlugIn.Store/build.ps1
  2. Copy the contents of Serilog.Sinks.KineticSeqPlugIn.Store/deployment to a location on your Kinetic application server
  3. Set the following enviroment variables on the machine
Environment Variable Value
DOTNET_SHARED_STORE <Location from step #2>\store (i.e. C:\dotnet\store)
DOTNET_ADDITIONAL_DEPS <Location from step #2>\additionalDeps (i.e. C:\dotnet\additionalDeps)
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES Serilog.Sinks.KineticSeqPlugIn
  1. Open the AppServer.config in the Kinetic server application files
  2. Add the following section to <appSettings>
<appSettings>
  <!-- KineticSeqPlugIn -->
  <add key="serilog:using:KineticSeq" value="Serilog.Sinks.KineticSeqPlugIn" />
  <add key="serilog:write-to:KineticSeq.serverUrl" value="<your-seq-server-url>" />
  <add key="serilog:write-to:KineticSeq.apiKey" value="<your-api-key>" />
</appSettings>
  1. Turn on any logging from the Epicor Administration Console that you wish to log
  2. Recycle Kinetic Application Pool
  3. Enjoy your logs being fed directly to Seq!

image

2 Likes