Repository navigation
Description
Package
Sentry.AspNetCore
.NET Flavor
.NET Core
.NET Version
8.0.413
OS
Windows
OS Version
Windows 11 Enterprise 24H2
Development Environment
Visual Studio Code (Windows)
SDK Version
5.14.1
Self-Hosted Sentry Version
No response
Workload Versions
dotnet workload list
Installed Workload Id Manifest Version Installation Source
--------------------------------------------------------------------
Use `dotnet workload search` to find additional workloads to install.
UseSentry or SentrySdk.Init call
I just call builder.WebHost.UseSentry() in Program.cs.
Steps to Reproduce
- Create an ASP.NET Core hello world app
- Run
dotnet add package Sentry.AspNetCore - Edit appsettings.json as below
- Include this in Program.cs:
builder.WebHost.UseSentry();
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
},
"File": {
"Path": null
}
},
"Sentry": {
"Dsn": "https://[email protected]/xxx",
"SendDefaultPii": true,
"MaxRequestBodySize": "Always",
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Debug",
"AttachStackTrace": true,
"Debug": true,
"DiagnosticLevel": "Error",
"TracesSampleRate": 1.0,
"Experimental": {
"EnableLogs": true
}
}
}Expected Result
https://docs.sentry.io/platforms/dotnet/guides/extensions-logging/logs/#server-attributes says there shall be a server.address attribute in Logs. There doesn't seem to be. I expected something like this where the server.address is present.
{
"payload_size": "577",
"project_id": "xxx",
"tags[microsoft.extensions.logging.event.id,number]": "2",
"timestamp_precise": "1756899350742000000",
"environment": "development",
"message": "Connection id \"0HNFARN182IEO\" stopped.",
"message.parameter.ConnectionId": "0HNFARN182IEO",
"message.template": "Connection id \"{ConnectionId}\" stopped.",
"microsoft.extensions.logging.category_name": "Microsoft.AspNetCore.Server.Kestrel.Connections",
"microsoft.extensions.logging.event.name": "ConnectionStop",
"release": "[email protected]+xxx",
"sdk.name": "sentry.dotnet.aspnetcore",
"sdk.version": "5.14.1",
"server.address": "Foo",
"severity": "debug",
"trace": "ad624f73866444b9a0f18424e4e0e64f",
"trace.parent_span_id": "60d35e983820623a",
"id": "dbfc4db54fe883ac1871d6985c0f9901",
"observed_timestamp_nanos": "1756899355847905746"
}Actual Result
I get this, notice server.address is not present:
{
"payload_size": "577",
"project_id": "xxx",
"tags[microsoft.extensions.logging.event.id,number]": "2",
"timestamp_precise": "1756899350742000000",
"environment": "development",
"message": "Connection id \"0HNFARN182IEO\" stopped.",
"message.parameter.ConnectionId": "0HNFARN182IEO",
"message.template": "Connection id \"{ConnectionId}\" stopped.",
"microsoft.extensions.logging.category_name": "Microsoft.AspNetCore.Server.Kestrel.Connections",
"microsoft.extensions.logging.event.name": "ConnectionStop",
"release": "[email protected]+xxx",
"sdk.name": "sentry.dotnet.aspnetcore",
"sdk.version": "5.14.1",
"severity": "debug",
"trace": "ad624f73866444b9a0f18424e4e0e64f",
"trace.parent_span_id": "60d35e983820623a",
"id": "dbfc4db54fe883ac1871d6985c0f9901",
"observed_timestamp_nanos": "1756899355847905746"
}I can put a server.address attribute there by changing my call to UseSentry like this:
builder.WebHost.UseSentry(o =>
{
o.Experimental.SetBeforeSendLog(static log =>
{
log.SetAttribute("server.address", Environment.MachineName);
return log;
});
});Having to do this is not consistent with the documentation at https://docs.sentry.io/platforms/dotnet/guides/extensions-logging/logs/#server-attributes
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsDone
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear commentedon Sep 3, 2025
NET-438 server.address is missing
[-]server.address is missing[/-][+]server.address is missing from Structured Logs[/+]jamescrosswell commentedon Sep 3, 2025
Thanks for the early feedback @tsondergaard !
@Flash0ver it looks like this already gets added automatically for events (just not yet for structured logs):
sentry-dotnet/test/Sentry.AspNetCore.Tests/AspNetCoreEventProcessorTests.cs
Lines 24 to 32 in 15f3094
jamescrosswell commentedon Nov 26, 2026
Fixed in #5216 (6.7.0). Structured logs now carry
server.address, taken fromServerNameif you set one, or from the machine name whenSendDefaultPiiis on. Sending the machine name withoutSendDefaultPiiis tracked in #5957.