Start your 14-day free trial today

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

Use Serilog to easily send .NET Core logs to your Logit.io Stack.

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 - Check Logit.io for your logsCopy

Now you should view your logs:

Launch Dashboard

If you don't see logs take a look at How to diagnose no data in Stack below for how to diagnose common issues.

Step 5 - how to diagnose no data in StackCopy

If you don't see data appearing in your Stack after following the steps, visit the Help Centre guide for steps to diagnose no data appearing in your Stack or Chat to support now.

Step 6 - .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

Compact View

Return to Search

© 2023 Logit.io Ltd, All rights reserved.