Follow this step by step guide to get 'logs' from your system to Logit.io:
Step 1 - Install
Installing Serilog You will need to add the Serilog and Serilog.Sinks.Network packages. This guide will also use appSettings to configure Serilog.
Install-Package Serilog Install-Package Serilog.Sinks.Network Install-Package Serilog.Settings.AppSettings
Step 2 - Configuring Serilog
Add AppSettings to your app.config or web.config.
Step 3 - Using Serilog
Create a statically accessible Logger configured from AppSettings.
Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger();
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 Documentation for more information.
Step 4 - Check Logit.io for your logs
Now you should view your 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 6 - Serilog Logging Overview
Serilog is a popular logging library for .NET and unlike many other logging libraries, it has been built with a focus on presenting log data in a structured & organised format. These event log messages & log files are preserved in the JSON format.
Without needing to alter your code, Serilog uses sinks to send logs in a text-based format to a centralised log management platform for further processing. If you can't or don't wish to use Serilog for structured logging, alternatively you can use either NLog or log4net for migrating your log data from .Net.
For alerting & monitoring, many Serilog users use an email sink for writing events to SMPT. This will quickly leave your inbox flooded when your application encounters an issue. A far less troublesome alternative to this can be to use an intuitive alerting and error monitoring platform that allows you to define alerts with a higher level of customisation & outputs to Slack, Asana, or WebHooks.
Logit.io provides alerting & monitoring as part of our platform that can be customised to output events to many popular third party tools. Our platform provides a completely managed Elastic Stack solution allowing you to get the best out of your .Net logs and provides a Serilog log analyser across all plans.
If you need any more help with shipping Serilog logs to Logstash our team 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.