Get a DemoStart Free TrialSign In

Serilog .NET Core Configuration

Ship logs from ASP.Net Core to Logstash with Serilog

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

Send Your DataLogsLanguages & LibrariesSerilog .NET Core Configuration Guide

Follow this step by step guide to get 'logs' from your system to

Step 1 - Install

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 Serilog

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 Serilog

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

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

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 for your logs

Now you should view your data:

View my data

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 Stack

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 Overview

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

Return to Search
Sign Up

© 2023 Ltd, All rights reserved.