Alex's Coding Blog
  • home
  • about
  • projects
  • contact

Blog

Easily track and troubleshoot errors in your .NET 7 web app using Konso's logging feature

  • May 18, 2023
  • by Alexander

Observability is obviously the thing for next couple of years. It is one of system's attributes, which differs modern system from legacy.

The starting point for every project's observability is our old friend - logging. Major problem with logs is that Developers usually do not like adding logs to their code, the business, in its turn, doesn't see a value of it and topic usually gets deprioritized.

Everyone recalls of logs when something bad happens. To avoid this sort of adventures, logs should be in code from day one and maintained as project grows.

Another, but not less dramatic problem is that amount of log data is huge, specially for microservices solutions. Developers do have a hard time to find something valuable in such data chaos. Konso is about to address this exact problem.

We created Konso based on our internal product we developed and maintained for years as development team. Konso allows easily explore logs and integration is super fast without an agent installation.

Here in this post I would like to show how can you quickly integrate with konso and start receiving and explore data.

Create konso account, it has free plan :)

Create a new bucket

image

  1. Add Logging functionality to your bucket

image

  1. Clone source or install nuget package to your project

Repository from github

git clone https://github.com/konsoio/konso-logs-clients-dotnet .

Nuget usage

Install-Package Konso.Clients.Logging
  1. Configuration

Go to Settings -> API access for obtaining api-key and bucket id

image

Add configuration to your **appsettings.json**

"Konso": {
    "Logging": {
        "Endpoint": "https://apis.konso.io",
        "BucketId": "<your bucket id>",
        "ApiKey": "<bucket's access key>",
        "App": "api",
        "Level": "Information"
    }
}

Then configure logging

.ConfigureLogging(logging => {
    logging.ClearProviders();
    logging.AddKonsoLogger();
})
.ConfigureServices((hostContext, services) =>
{
    var _logsConfig = new KonsoLoggerConfig();
    _logsConfig.Endpoint = hostContext.Configuration.GetValue<string>("Konso:Logging:Endpoint");
    _logsConfig.BucketId = hostContext.Configuration.GetValue<string>("Konso:Logging:BucketId");
    _logsConfig.AppName = hostContext.Configuration.GetValue<string>("Konso:Logging:App");
    _logsConfig.ApiKey = hostContext.Configuration.GetValue<string>("Konso:Logging:ApiKey");
    services.AddSingleton(_logsConfig);
    services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
})

Now you can run your project

  1. Navigate to Observability -> Logs -> Overview to find logging dashboard

image

Next, you can navigate to the Explore screen to search for, filter, and delve into the detailed information about the project's logs.

Detailed API reference can be found https://docs.konso.io/api/logs

Check out the example of todo application with logging on GitHub: todo. It provides a hands-on demonstration of how to use Konso logging, allowing you to explore the code and understand the underlying concepts.

.NET Core How-to

🚀 Turbocharge Your Kubernetes Cluster with my Terraform Kits! 🚀

🌟 Slash deployment time and costs! Discover the ultimate solution for efficient, cost-effective Kubernetes Terraform Kits. Perfect for DevOps enthusiasts looking for a reliable, scalable setup.

Learn More about Terraform Kits for AKS,EKS and GKE

Alexander Lvovich

Solution Architect & Software Developer | Automating & Scaling Infrastructure

💡 Working with Kubernetes, Istio, and DevOps. Got questions? Feel free to reach out!

Share on:

No comments are allowed for this post

Recent Posts

  • Securing Web Services Against Unwanted Traffic with NGINX
  • Optimizing API by Offloading Responsibilities to an API Gateway
  • How to Clean Up Local Branches of Remote Merged Branches
  • Resolving Namespace Overriding in Argo CD with Kustomize
  • Connecting to Gitlab's private Nuget registry
  • Why Istio?

Categories

  • Azure
  • Architecture
  • .NET Core
  • Certification
  • DevOps
  • How-to
  • Azure Functions
  • Serverless
  • Cosmos DB
  • Security
  • Thoughts
  • Kubernetes
  • Istio
© Copyright 2025, Alexander Lvovich. Theme by Colorlib
I use cookies and similar technologies on our website to enhance your browsing experience and analyze website traffic. By clicking "Accept," you consent with my Privacy Policy to the use of these technologies.
Accept