Soenneker.Middlewares.TrafficLogging
11.0.539
Prefix Reserved
dotnet add package Soenneker.Middlewares.TrafficLogging --version 11.0.539
NuGet\Install-Package Soenneker.Middlewares.TrafficLogging -Version 11.0.539
<PackageReference Include="Soenneker.Middlewares.TrafficLogging" Version="11.0.539" />
<PackageVersion Include="Soenneker.Middlewares.TrafficLogging" Version="11.0.539" />
<PackageReference Include="Soenneker.Middlewares.TrafficLogging" />
paket add Soenneker.Middlewares.TrafficLogging --version 11.0.539
#r "nuget: Soenneker.Middlewares.TrafficLogging, 11.0.539"
#:package Soenneker.Middlewares.TrafficLogging@11.0.539
#addin nuget:?package=Soenneker.Middlewares.TrafficLogging&version=11.0.539
#tool nuget:?package=Soenneker.Middlewares.TrafficLogging&version=11.0.539
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 | net11.0 is compatible. |
-
net11.0
- Soenneker.Extensions.Stream (>= 11.0.175)
- Soenneker.Extensions.String (>= 4.0.800)
- Soenneker.Extensions.Task (>= 11.0.141)
- Soenneker.Extensions.ValueTask (>= 4.0.133)
- Soenneker.Utils.PooledStringBuilders (>= 11.0.44)
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 |
|---|---|---|
| 11.0.539 | 0 | 10/26/2026 |
| 11.0.538 | 0 | 10/26/2026 |
| 11.0.537 | 0 | 10/26/2026 |
| 11.0.536 | 0 | 10/26/2026 |
| 11.0.535 | 33 | 10/26/2026 |
| 4.0.534 | 218 | 10/15/2026 |
| 4.0.533 | 95 | 10/15/2026 |
| 4.0.532 | 85 | 10/15/2026 |
| 4.0.531 | 84 | 10/14/2026 |
| 4.0.530 | 88 | 10/14/2026 |
| 4.0.528 | 89 | 10/14/2026 |
| 4.0.527 | 88 | 10/14/2026 |
| 4.0.524 | 90 | 10/14/2026 |
| 4.0.516 | 97 | 10/13/2026 |
| 4.0.514 | 96 | 10/12/2026 |
| 4.0.512 | 98 | 10/12/2026 |
| 4.0.511 | 97 | 10/12/2026 |
| 4.0.508 | 104 | 10/11/2026 |
| 4.0.507 | 96 | 10/11/2026 |
| 4.0.506 | 209 | 9/30/2026 |
Enable runtime async for compatible .NET 11 projects