Serilog.Sinks.SentrySDK 1.0.7.2

dotnet add package Serilog.Sinks.SentrySDK --version 1.0.7.2
                    
NuGet\Install-Package Serilog.Sinks.SentrySDK -Version 1.0.7.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Serilog.Sinks.SentrySDK" Version="1.0.7.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Serilog.Sinks.SentrySDK" Version="1.0.7.2" />
                    
Directory.Packages.props
<PackageReference Include="Serilog.Sinks.SentrySDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Serilog.Sinks.SentrySDK --version 1.0.7.2
                    
#r "nuget: Serilog.Sinks.SentrySDK, 1.0.7.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Serilog.Sinks.SentrySDK@1.0.7.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Serilog.Sinks.SentrySDK&version=1.0.7.2
                    
Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.SentrySDK&version=1.0.7.2
                    
Install as a Cake Tool

Serilog.Sinks.SentrySDK

A Serilog sink for Sentry that simplifies error and log management in your applications. It builds on the Sentry .NET SDK and official Serilog integration.

Based on serilog-contrib/serilog-sinks-sentry

Project status

.NET Core Test .NET Core CI codecov GitHub Release

NuGet Serilog.Sinks.SentrySDK NuGet Serilog.Sinks.SentrySDK downloads NuGet Serilog.Sinks.SentrySDK.AspNetCore NuGet Serilog.Sinks.SentrySDK.AspNetCore downloads

Available packages

Release 1.0.7.2 on NuGet aligns with GitHub tags such as v1.0.7.2. GitHub Releases carry the changelog and attached .nupkg assets.

Package When to use
Serilog.Sinks.SentrySDK Core sink; net6.0 and net10.0 in one package (lib/net6.0/, lib/net10.0/).
Serilog.Sinks.SentrySDK.AspNetCore HTTP context integration and middleware; net6.0 + net10.0.
Serilog.Sinks.SentrySDK.6 / Serilog.Sinks.SentrySDK.AspNetCore.6 Same sink and ASP.NET Core extras; net6.0-only package ids.
Serilog.Sinks.SentrySDK.10 / Serilog.Sinks.SentrySDK.AspNetCore.10 Same functionality; net10.0-only package ids.

Prefer the main ids unless you want a single target framework per NuGet package id.

Installation

Core sink:

dotnet add package Serilog.Sinks.SentrySDK
Install-Package Serilog.Sinks.SentrySDK

ASP.NET Core companion (user/request context in logs):

dotnet add package Serilog.Sinks.SentrySDK.AspNetCore
Install-Package Serilog.Sinks.SentrySDK.AspNetCore

Alternate ids (single TFM per package): Serilog.Sinks.SentrySDK.6, Serilog.Sinks.SentrySDK.10, and matching AspNetCore ids — see Available packages.

This stack references the Sentry NuGet package (6.3.2), the same major line as Sentry for .NET. For DSN, SendDefaultPii, and debug options, see the Quick Start. Initialize as early as possible so startup failures are reported. This sink calls SentrySdk.Init when you configure WriteTo.Sentry with a DSN; avoid a second SentrySdk.Init in the same process unless you deliberately use one initialization path.

Set a valid Sentry DSN in appsettings.json or in code. Without a DSN, the sink throws when the DSN argument is empty. Demos show JSON and programmatic configuration.

Getting started

Add the sink so logs are sent to Sentry. You can use Serilog.Settings.Configuration with JSON:

{
  "Serilog": {
    "Using": [ "Serilog.Sinks.SentrySDK" ],
    "MinimumLevel": "Debug",
    "WriteTo": [
      {
        "Name": "Sentry",
        "Args": {
          "dsn": "YOUR_SENTRY_DSN",
          "sendDefaultPii": true,
          "environment": "Development",
          "release": "1.0.7.2",
          "attachStacktrace": true,
          "tracesSampleRate": 1.0
        }
      }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
    "Properties": {
      "Application": "Sample"
    }
  }
}
var configuration = new ConfigurationBuilder()
    .SetBasePath(Directory.GetCurrentDirectory())
    .AddJsonFile("appsettings.json")
    .Build();

var log = new LoggerConfiguration()
    .ReadFrom.Configuration(configuration)
    .Enrich.FromLogContext()
    .CreateLogger();

log.Error("This error goes to Sentry.");

Optional configureSentryOptions and beforeSend on WriteTo.Sentry map to init-time SentryOptions and a chained SetBeforeSend. A fuller argument list and examples are in the repository README — Getting Started.

Data scrubbing

Use SetBeforeSend / SetBeforeSendTransaction on SentryOptions for client-side scrubbing; see Scrubbing sensitive data. Prefer the sink’s optional beforeSend callback for event filtering; use configureSentryOptions for other flags (for example EnableLogs, EnableMetrics) and do not call SetBeforeSend inside that callback, because the sink registers its own SetBeforeSend chain. You can still use Serilog filters and enrichers to limit what reaches the sink.

Capturing HttpContext (ASP.NET Core)

Install Serilog.Sinks.SentrySDK.AspNetCore, then extend the logger:

var log = new LoggerConfiguration()
    .WriteTo.Sentry("YOUR_SENTRY_DSN")
    .Enrich.FromLogContext()
    .Destructure.With<HttpContextDestructingPolicy>()
    .Filter.ByExcluding(e => e.Exception?.CheckIfCaptured() == true)
    .CreateLogger();

Register middleware (for example in Startup / pipeline setup):

app.AddSentryContext();

Full snippets, including older Startup.cs examples, are in the repository README — Capturing HttpContext.

Sentry SDK options vs this sink

This package aligns with Sentry .NET 6.3.2. The repository README maps SentryOptions properties and methods to WriteTo.Sentry parameters (large tables): Sentry SDK and Mapping to WriteTo.Sentry.

Further reading: Data Management, Structured logs, Migration guide.

Demos, build, contributing

Full documentation (CI, publishing, formatting): README.md on GitHub.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7.2 65 4/16/2026
1.0.6 92,517 3/11/2024
1.0.5 64,906 7/17/2023

1.0.7.2: includes net6.0 and net10.0. Release notes: https://github.com/antoinebou12/Serilog.Sinks.SentrySDK/releases