Logging is an essential part of any application. When we are investigating problems or looking for patterns in our systems, we want our log data to be easy to query. Serilog empowers us to log meaningful, rich data that enables us to write complex queries and save time diagnosing faults. Serilog also has low up-front implementation cost with a clean, simple API.
Introduction to Structured Logging Hi. I'm Jason Roberts from Pluralsight. Welcome to this course on Modern Structured Logging with Serilog and Seq. Structured logging is a technique whereby where instead of writing just plain text data to our log files we actually write meaningful log data by writing properties that are relevant to our application and values for those properties. Because we're logging structured data as opposed to just text data we can then go and write queries against this structured data to provide insight into our applications. In this first module we're going to take a look at why we might want to use structured logging and we'll compare it against the traditional logging approach of simply writing text to files or perhaps a field in SQL server. We'll then see some of the queries that we could perform if we're logging rich, structured log data instead of simple text data that we have to query with techniques, such as regular expressions. Next, we'll take a look at the open source Serilog library and how we can still use it to write unstructured data to traditional text files, but also how we can write structured log data to a NoSQL store so we can perform rich queries against it. We'll see a brief example of the Serilog syntax, how we can log named properties and values associated with those properties, and also some of the backend logging stores that Serilog supports. Next, we'll get an introduction to the Seq application and this is a server-based application that we install onto our servers that allow us to write log messages to it using Serilog. Once we've written structured log messages to Seq we can then use the Seq user interface to actually query our log data.
Serilog Fundamentals Hi. Welcome to this module on Serilog Fundamentals. In this module we're going to start off by seeing how we can get started with Serilog in Visual Studio, we'll see how we can install the relevant NuGet package, how we can configure a logger, and then how we can log informational messages to the console. Next, we'll see how we can configure Serilog to log to text files, so this could be a single individual file or a series of files that represent log files for each individual day. Next, we'll see how Serilog deals with different types of values, so we'll learn about the types that Serilog considers scalar and how Serilog automatically stores these data values, we'll see how Serilog handles collections that implement IEnumerable, and we'll also learn what happens when Serilog tries to store an object that doesn't fall into these scalar or collection classes, and then how we can instruct Serilog to save the individual values within our objects. Finally, we'll learn that logging sinks enable us to write log data to various systems, and we'll learn about the sinks that are available to us to write our log data to various external systems, and then we'll get a demonstration how we can configure RavenDB as a log store, and once we've stored log information in RavenDB, how we can then make use of this structured data to actually perform queries against our log data.
Seq Hi. Welcome back to the final module in this course. In this module we're going to be taking a look at the Seq software. This is software that we can install on one of our servers and we can write Serilog messages to it. Once we've written our log messages to it we can utilize the Seq dashboard to go and query these log messages, create views and queries, and setup watches to count the instances of certain types of events. In this module we're going to start off by getting a brief overview of how the Seq architecture fits together, so this is how the Seq server accepts messages from our application, and how we can use a browser to access all logs. Next, we'll get an overview of how to download and install Seq. We'll then see how we need to download the Seq NuGet package for Serilog and then how, once we've downloaded this package, we can configure our Serilog logger to write messages to Seq. We'll then take a look at the Seq web interface itself and the types of queries that we can write, including free text queries that just searches all of our messages for instances of specified text, and also how we can write queries that actually drill into specific property values that we've written with Serilog. Next, we'll take a look at how we can define and save views for later use, so this could be could a query to see all errors in a specific application or a view to filter out all events that aren't errors or fatal errors. We'll see how we can configure Seq to delete messages over a certain age and how we can use a view that we've already defined to limit exactly what gets deleted, so this could mean separate retention strategies for different applications that we're logging. Finally, we'll take a look at what Seq apps are and how we can install one and configure it.