Start your 14-day free trial today & Get 20% Off All Annual Managed ELK Plans

No Credit Card Required

Try Logit.io Free

Already have an account? Sign In

Send data via .NET Core to your Logstash instance provided by Logit.io

Serilog .NET Core Configuration

Ship logs from ASP.Net Core to Logstash with Serilog

Step 1 - InstallCopy

You will need the main Serilog.AspNetCore package and Serilog.Sinks.Network to send logs using TCP/TLS or UDP.

Serilog.Settings.Configuration is needed to setup Serilog using settings from appsettings.json (instead of hardcoded settings).

Install-Package Serilog.AspNetCore
Install-Package Serilog.Settings.Configuration
Install-Package Serilog.Sinks.Network

Step 2 - Configuring SerilogCopy

No TCP-SSL input available! Your stack is missing the required input for this data source, you can send over TCP and UDP but this is not recommended Talk to support to add the input

Step 3 - Using SerilogCopy

Inside Program.cs, add Serilog to the WebHost build process:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
       .UseSerilog((ctx, config) => { config.ReadFrom.Configuration(ctx.Configuration); })
       .UseStartup<Startup>();

You can now log from anywhere in your application.

Log.Information("The global logger has been configured");

Serilog is a fully featured logging framework and has many other capabilities that are not detailed here.

Please see the Serilog.AspNetCore Documentation for more information.

Step 4 - .NET Core Logging OverviewCopy

.NET Core is an open-source platform created by Microsoft for development across Linux, macOS & Windows and makes .NET itself run as a cross-platform framework. It can be used to write APIs, and ASP.NET websites.

Tracing & tailing logs for .NET Core can often encounter difficulties when debugging over longer time periods. If these log messages are being recorded across distributed environments then it can make centralising your logs nearly impossible for logging analysis and management at scale.

The Logit.io platform offers hosted Kibana which makes visualising .NET Core log instances far more streamlined than comparable logging solutions. We believe that monitoring & analysis play a crucial role in maintaining the health of your applications across the cloud & on-premise.

If you need any help with migrating your .NET Core logs to Logstash we are here to help. Feel free to visit our Help Centre or get in contact with our support team by sending us a message via live chat & we'll be happy to assist.

Toggle View

Expand View

Return to Search