Soenneker.Middlewares.TrafficLogging
4.0.506
Prefix Reserved
dotnet add package Soenneker.Middlewares.TrafficLogging --version 4.0.506
NuGet\Install-Package Soenneker.Middlewares.TrafficLogging -Version 4.0.506
<PackageReference Include="Soenneker.Middlewares.TrafficLogging" Version="4.0.506" />
<PackageVersion Include="Soenneker.Middlewares.TrafficLogging" Version="4.0.506" />
<PackageReference Include="Soenneker.Middlewares.TrafficLogging" />
paket add Soenneker.Middlewares.TrafficLogging --version 4.0.506
#r "nuget: Soenneker.Middlewares.TrafficLogging, 4.0.506"
#:package Soenneker.Middlewares.TrafficLogging@4.0.506
#addin nuget:?package=Soenneker.Middlewares.TrafficLogging&version=4.0.506
#tool nuget:?package=Soenneker.Middlewares.TrafficLogging&version=4.0.506
Soenneker.Middlewares.TrafficLogging
Adds structured ASP.NET Core request and response logging with sensitive payload capture disabled by default.
Installation
dotnet add package Soenneker.Middlewares.TrafficLogging
Registration
No service registration is required:
using Soenneker.Middlewares.TrafficLogging.Registrars;
app.UseTrafficLogging();
app.MapControllers();
Place it before endpoints and other middleware whose responses should be logged. WebSocket requests are passed through without traffic logging. If Information logging is disabled for Soenneker.Middlewares.TrafficLogging.TrafficLoggingMiddleware, the middleware adds no request or response capture.
Default output
The default log records method, scheme, host, path, response status, and known body length. It does not log query strings, headers, request bodies, or response bodies.
Enable additional fields individually through configuration:
{
"TrafficLogging": {
"LogHeaders": true,
"LogQueryString": false,
"LogRequestBody": false,
"LogResponseBody": false
}
}
Headers whose names indicate authorization, cookies, API keys, secrets, or tokens are always replaced with [REDACTED]. Header values are capped at 512 characters.
Text-like request and response bodies are captured only when their respective setting is enabled, and only the first 32 KiB is logged. Request body capture is skipped for GET, HEAD, DELETE, and TRACE, for declared empty bodies, for declared bodies over 5 MiB, and for non-text content types. Response capture forwards writes immediately and retains only the capped prefix, so it does not buffer the complete response or delay streaming output.
Security considerations
Opt-in data can still contain passwords, access tokens, personal information, and application-specific secret headers that a name-based redactor cannot identify. Query strings and JSON/form bodies are especially high risk. Enable them only in a controlled environment with appropriate log access, retention, and deletion policies.
Captured text is sanitized for control characters to prevent line-oriented log injection. Host names, paths, header values, and payload text remain attacker-controlled data and should not be used to construct log templates or security decisions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Soenneker.Extensions.Stream (>= 4.0.156)
- Soenneker.Extensions.String (>= 4.0.770)
- Soenneker.Extensions.Task (>= 4.0.131)
- Soenneker.Extensions.ValueTask (>= 4.0.124)
- Soenneker.Utils.PooledStringBuilders (>= 4.0.34)
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 |
|---|---|---|
| 4.0.506 | 91 | 9/30/2026 |
| 4.0.505 | 83 | 9/29/2026 |
| 4.0.504 | 87 | 9/25/2026 |
| 4.0.503 | 91 | 9/25/2026 |
| 4.0.502 | 90 | 9/24/2026 |
| 4.0.500 | 87 | 9/24/2026 |
| 4.0.499 | 90 | 9/24/2026 |
| 4.0.498 | 168 | 9/16/2026 |
| 4.0.497 | 88 | 9/16/2026 |
| 4.0.496 | 96 | 9/16/2026 |
| 4.0.495 | 93 | 9/16/2026 |
| 4.0.494 | 97 | 9/16/2026 |
| 4.0.493 | 101 | 9/15/2026 |
| 4.0.492 | 100 | 9/13/2026 |
| 4.0.490 | 101 | 9/13/2026 |
| 4.0.489 | 101 | 9/13/2026 |
| 4.0.488 | 102 | 9/12/2026 |
| 4.0.487 | 96 | 9/12/2026 |
| 4.0.486 | 91 | 9/12/2026 |
| 4.0.485 | 88 | 9/12/2026 |
Updated Soenneker.Extensions.String to 4.0.770