Out-of-the-box Request tracking
This new version allows you to track incoming requests by using a new middleware component which is built on top of ILogger.LogRequest
(👋 Arcus Observability).
public void Configure(IApplicationBuilder app, IWebHostEvironment env) | |
{ | |
app.UseRequestTracking(); | |
... | |
app.UseMvc(); | |
} |
By default, we do not track the request body but do include most HTTP headers. However, for security reasons we have a default set of headers to omit or obfuscate.
Example:
HTTP Request POST http://localhost:5000/weatherforecast completed with 200 in 00:00:00.0191554 at 03/23/2020 10:12:55 +00:00 - (Context: [Content-Type, application/json], [Body, {"today":"cloudy"}])
As always, we allow you to fully configure it to how you want it to behave by using our fluent options API for UseRequestTracking
:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
app.UseRequestTracking(options => | |
{ | |
// Whether or not the HTTP request body should be included in the request tracking logging emits. | |
// (default: `false`) | |
options.IncludeRequestBody = true; | |
// Whether or not the configured HTTP request headers should be included in the request tracking logging emits. | |
// (default: `true`) | |
options.IncludeRequestHeaders = true; | |
// All omitted HTTP request header names that should always be excluded from the request tracking logging emits. | |
// (default: `[ "Authentication", "X-Api-Key", "X-ARR-ClientCert" ]`) | |
options.OmittedRequestHeaderNames.Add("X-My-Secret-Header"); | |
}); | |
... | |
app.UseMvc(); | |
} |
For more information, see the docs.
Making it easier to use HTTP correlation
Up until now it was a bit cumbersome to use HTTP correlation. We have now added an easier way to start using HTTP correlation with Serilog with the following extensions:
ublic void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHttpCorrelation(); | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
app.UseHttpCorrelation(); | |
Log.Logger = new LoggerConfiguration() | |
.Enrich.WithHttpCorrelationInfo() | |
.WriteTo.Console() | |
.CreateLogger(); | |
} |
For more information on correlation, see the docs.
For more information, see the docs.
Breaking changes
Last but not least, we have simplified our package structure to make it easier to keep track of dependencies.
Here is an overview:
Arcus.WebApi.Security.Authentication
andArcus.WebApi.Security.Authorization
are now consolidated intoArcus.WebApi.Security
Arcus.WebApi.Correlation
has been moved intoArcus.WebApi.Logging
Starting from this version, the different packages
Arcus.WebApi.Security.Authentication
andArcus.WebApi.Security.Authorizatio
have been merged together inArcus.WebApi.Security
.
The reason for this was that the functionality in both packages is mostly all the time used togehter and doesn’t have much meaning on its own.- Starting from this version, we have decided to merge the correlation and logging functionality into a single package:
Arcus.WebApi.Logging
.
This for the very reason that both the functionality present in the correlation and logging packages is mostly all the time used together.
Thanks for reading!
Stijn & Tom
Subscribe to our RSS feed