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
<PackageReference Include="Serilog.Sinks.ApplicationInsights.AspNetCore" Version="1.0.3" />
<PackageVersion Include="Serilog.Sinks.ApplicationInsights.AspNetCore" Version="1.0.3" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights.AspNetCore" />
paket add Serilog.Sinks.ApplicationInsights.AspNetCore --version 1.0.3
#r "nuget: Serilog.Sinks.ApplicationInsights.AspNetCore, 1.0.3"
#:package Serilog.Sinks.ApplicationInsights.AspNetCore@1.0.3
#addin nuget:?package=Serilog.Sinks.ApplicationInsights.AspNetCore&version=1.0.3
#tool nuget:?package=Serilog.Sinks.ApplicationInsights.AspNetCore&version=1.0.3
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 theApplicationInsightsconfiguration section.AddApplicationInsightsAzureAD— optional DefaultAzureCredential for ingestion whenApplicationInsights:UseAzureCredentialis true.AddCrossErrorHandlersApplicationInsights— registersW3cActivityTelemetryInitializerandExtensionVersionTelemetryInitializer.UseTelemetryBaseInitializer— copiesSerilog:Properties:Application,Module, andEnvinto TelemetryClient.Context.GlobalProperties.ApplicationInsightsRequestLoggingMiddleware— emits Request-style telemetry per HTTP call viaLogAppInsightsRequest(use with Serilog AI sink +ApplicationInsightsTelemetryConverter).LoggerApplicationInsightsExtensions—LogAppInsightsEvent,Metric,Dependency,Request,ExceptiononILogger.
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
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-change). - Commit your changes with a clear message.
- Push the branch and open a pull request.
License
This project is licensed under the MIT License — see the LICENSE file for details.
| Product | Versions 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. |
-
net10.0
- Azure.Identity (>= 1.14.2)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- Serilog (>= 4.3.0)
- Serilog.Sinks.ApplicationInsights (>= 5.0.0)
-
net6.0
- Azure.Identity (>= 1.14.2)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Serilog (>= 4.3.0)
- Serilog.Sinks.ApplicationInsights (>= 5.0.0)
-
net7.0
- Azure.Identity (>= 1.14.2)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Serilog (>= 4.3.0)
- Serilog.Sinks.ApplicationInsights (>= 5.0.0)
-
net8.0
- Azure.Identity (>= 1.14.2)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Serilog (>= 4.3.0)
- Serilog.Sinks.ApplicationInsights (>= 5.0.0)
-
net9.0
- Azure.Identity (>= 1.14.2)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 9.0.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.14)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.14)
- Microsoft.Extensions.Logging (>= 9.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.14)
- Microsoft.Extensions.Options (>= 9.0.14)
- Serilog (>= 4.3.0)
- Serilog.Sinks.ApplicationInsights (>= 5.0.0)
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