SDKs
.NET SDK
Install the Logdash .NET SDK, send your first log and your first metric.
Install the package, add your ingest key and the first log lands in the dashboard within a second. Everything below is copied from the .NET SDK README.
Install
dotnet add package Logdash Initialise
Copy the ingest key from your domain's settings in Logdash and keep it in an environment variable. The key identifies the domain the data lands in, and app names the program that sends, such as api or worker. See Apps.
using Logdash;
using Logdash.Models;
var apiKey = Environment.GetEnvironmentVariable("LOGDASH_API_KEY");
var (logdash, metrics, events) = new LogdashBuilder()
.WithHttpClient(new HttpClient())
.WithInitializationParams(new InitializationParams(apiKey, App: "api"))
.Build(); Send a log
logdash.Info("This is info message");
logdash.Warn("This is warn message");
logdash.Error("This is an error message");
logdash.Debug("This is a debug message"); Send a metric
Metrics are named numbers. Set one to an absolute value or mutate it by a delta, and Logdash charts the history.
// to set absolute value
metrics.Set("key", 2);
// or increment / decrement by
metrics.Mutate("key", 3); Send an event
Events go to web analytics of the domain, next to the custom events of your website, with the same rules for names and properties.
events.Track("agent_run", new Dictionary<string, object>
{
["agent"] = "support",
["steps"] = 4,
["success"] = true,
}, userId: user.Id); Works with
- ASP.NET Core
- Minimal APIs
- Worker Services
- Blazor
- Console apps
FAQ
How do I register it in ASP.NET Core?
Call
builder.Services.AddLogdash(new InitializationParams(apiKey)), then take ILogdashLogger, ILogdashMetrics and ILogdashEvents as constructor parameters in your controllers and services.Can I use it without dependency injection?
Yes.
new LogdashBuilder().WithHttpClient(...).WithInitializationParams(...).Build() returns a logger, a metrics client and an events client as a tuple.What happens if I leave the API key out?
Logs go to the local console only. There is also a
host parameter if you are running a self-hosted Logdash, and verbose if you need to debug the SDK itself.Copied from the dotnet-sdk README at 6ba1186 on 2026-11-09.