Learn more about Streama© – the foundational technology behind our stateful streaming data platform. Learn More

SeriLog for .Net Core

If you are using SeriLog as your logger in .Net Core, you can use Coralogix Sink to push logs to your Coralogix Account.

The first thing you need to do is fetch SeriLog.Sinks.Coralogix from NuGet


https://www.nuget.org/packages/Coraloigx.Serilog/

Coralogix Sinks needs to be configured with your PrivateKey ApplicationName and SubSystemName.

Here is an example:

using Serilog.Sinks.Coralogix;
using Serilog;
....

var log = new LoggerConfiguration()
                .WriteTo.CoralogixSink(new CoralogixSinkOptions
                {
                    PrivateKey = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx",
                    ApplicationName = "myApp",
                    SubsystemName = "mySubs"
                })
                .CreateLogger();

If your Coralogix account domain ends up in .us or .in you need to set up your endpoint URL accordingly.

For .us:

set env-var CORALOGIX_LOG_URL="https://api.coralogix.us:443/api/v1/logs"

For .in:

set env-var CORALOGIX_LOG_URL="https://api.app.coralogix.in:443/api/v1/logs"