Serilog.Sinks.ApplicationInsights.AspNetCore 1.0.3

dotnet add package Serilog.Sinks.ApplicationInsights.AspNetCore --version 1.0.3
                    
NuGet\Install-Package Serilog.Sinks.ApplicationInsights.AspNetCore -Version 1.0.3
                    
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.ApplicationInsights.AspNetCore" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Serilog.Sinks.ApplicationInsights.AspNetCore" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Serilog.Sinks.ApplicationInsights.AspNetCore" />
                    
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.ApplicationInsights.AspNetCore --version 1.0.3
                    
#r "nuget: Serilog.Sinks.ApplicationInsights.AspNetCore, 1.0.3"
                    
#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.ApplicationInsights.AspNetCore@1.0.3
                    
#: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.ApplicationInsights.AspNetCore&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.ApplicationInsights.AspNetCore&version=1.0.3
                    
Install as a Cake Tool

License GitHub Release Date NuGetVersion NugetDownloads Coverage issues .NET PR

Size GitHub contributors GitHub commits since latest release (by date) Activity Activity Activity

Serilog.Sinks.ApplicationInsights.AspNetCore

Companion helpers for Serilog and Application Insights on ASP.NET Core: DI registration, W3C correlation initializers, optional request logging middleware, and ILogger extensions that emit structured telemetry when used with Serilog.Sinks.ApplicationInsights and the included converters.

Target frameworks: net6.0, net7.0, net8.0, net9.0, net10.0

Features

  • AddSerilogApplicationInsights — registers Application Insights for ASP.NET Core (AddApplicationInsightsTelemetry) and binds the ApplicationInsights configuration section.
  • AddApplicationInsightsAzureAD — optional DefaultAzureCredential for ingestion when ApplicationInsights:UseAzureCredential is true.
  • AddCrossErrorHandlersApplicationInsights — registers W3cActivityTelemetryInitializer and ExtensionVersionTelemetryInitializer.
  • UseTelemetryBaseInitializer — copies Serilog:Properties:Application, Module, and Env into TelemetryClient.Context.GlobalProperties.
  • ApplicationInsightsRequestLoggingMiddleware — emits Request-style telemetry per HTTP call via LogAppInsightsRequest (use with Serilog AI sink + ApplicationInsightsTelemetryConverter).
  • LoggerApplicationInsightsExtensionsLogAppInsightsEvent, Metric, Dependency, Request, Exception on ILogger.

Install NuGet package

Install the Serilog.Sinks.ApplicationInsights.AspNetCore NuGet package into your .NET project:

Install-Package Serilog.Sinks.ApplicationInsights.AspNetCore

or

dotnet add package Serilog.Sinks.ApplicationInsights.AspNetCore

Quick start (minimal API)

using Serilog;
using Serilog.Sinks.ApplicationInsights.AspNetCore.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseSerilog((context, _, configuration) =>
{
    configuration
        .ReadFrom.Configuration(context.Configuration)
        .Enrich.FromLogContext()
        .WriteTo.Console();
});

builder.Services
    .AddSerilogApplicationInsights(builder.Configuration)
    .AddApplicationInsightsAzureAD(builder.Configuration)
    .AddCrossErrorHandlersApplicationInsights();

var app = builder.Build();
app.UseTelemetryBaseInitializer();
app.MapGet("/", () => "OK");
app.Run();

Set ApplicationInsights:ConnectionString or the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable for live ingestion.

Demo

dotnet run --project Serilog.Sinks.ApplicationInsights.AspNetCore.Demo/Serilog.Sinks.ApplicationInsights.AspNetCore.Demo.csproj

Then open the URL from Properties/launchSettings.json (default http://localhost:5088).

Documentation

See Logging and Metrics for configuration, ILogger telemetry extensions, converters, optional request middleware, TelemetryClient.StartOperation, property keys, limits, and using the Azure portal.

Release notes

See ReleaseNotes.md.

Contributing

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-change).
  3. Commit your changes with a clear message.
  4. Push the branch and open a pull request.

License

This project is licensed under the MIT License — see the LICENSE file for details.

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 is compatible.  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 is compatible.  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 is compatible.  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.3 36 3/24/2026
1.0.3-preview.5 27 3/24/2026
1.0.3-preview.4 31 3/24/2026
1.0.2 59 3/24/2026
1.0.2-preview.2 21 3/24/2026
1.0.1 51 3/24/2026
1.0.1-preview.1 27 3/24/2026
1.0.0 69 3/23/2026
1.0.0-preview.1 32 3/23/2026

fix name convention