Fermat.EntityFramework.HttpRequestLogs
0.0.1
dotnet add package Fermat.EntityFramework.HttpRequestLogs --version 0.0.1
NuGet\Install-Package Fermat.EntityFramework.HttpRequestLogs -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fermat.EntityFramework.HttpRequestLogs" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fermat.EntityFramework.HttpRequestLogs" Version="0.0.1" />
<PackageReference Include="Fermat.EntityFramework.HttpRequestLogs" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fermat.EntityFramework.HttpRequestLogs --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fermat.EntityFramework.HttpRequestLogs, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fermat.EntityFramework.HttpRequestLogs@0.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fermat.EntityFramework.HttpRequestLogs&version=0.0.1
#tool nuget:?package=Fermat.EntityFramework.HttpRequestLogs&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Fermat.EntityFramework.HttpRequestLogs
Fermat.EntityFramework.HttpRequestLogs is a comprehensive HTTP request logging library for .NET applications that provides detailed tracking of HTTP requests, performance metrics, and request analysis. It's built on top of Entity Framework Core and follows clean architecture principles.
Features
- Detailed HTTP request and response logging
- Performance metrics tracking
- Client device and browser information
- Request rate analysis
- Response time statistics
- Error rate monitoring
- Endpoint performance analysis
- Client usage statistics
- Configurable sensitive data masking
- Flexible request filtering
- Automatic cleanup of old logs
Installation
dotnet add package Fermat.EntityFramework.HttpRequestLogs
Project Structure
The library follows Clean Architecture principles with the following layers:
Core
- Base entities and interfaces
- Domain models
- Enums and constants
- Configuration options
Infrastructure
- Entity Framework Core configurations
- Database context implementations
- Repository implementations
Application
- DTOs
- Interfaces
- Services
- Mappings
Presentation
- Controllers
- API endpoints
- Request/Response models
DependencyInjection
- Service registration extensions
- Configuration options
- Middleware implementation
Configuration
// Configure HTTP request logging in Startup.cs
builder.Services.AddFermatHttpRequestLogServices<ApplicationDbContext>(opt =>
{
// Enable/Disable request logging
opt.Enabled = true;
// Configure path exclusions
opt.ExcludedPaths = ["/health", "/metrics", "/favicon.ico"];
opt.ExcludedHttpMethods = ["OPTIONS"];
opt.ExcludedContentTypes = ["application/octet-stream", "application/pdf", "image/", "video/", "audio/"];
// Configure request body logging
opt.LogRequestBody = true;
opt.MaxRequestBodyLength = 5000;
opt.LogOnlySlowRequests = true;
opt.SlowRequestThresholdMs = 10;
// Configure sensitive data masking
opt.MaskPattern = "***MASKED***";
opt.RequestBodySensitiveProperties = [
"Password", "Token", "Secret", "Key", "Credential",
"Ssn", "Credit", "Card", "Description"
];
opt.QueryStringSensitiveProperties = [
"Password", "Token", "Secret", "ApiKey", "Key"
];
opt.HeaderSensitiveProperties = [
"Authorization", "Cookie", "X-Api-Key"
];
});
// Configure DbContext
public class YourDbContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Apply HTTP request log configurations
modelBuilder.ApplyConfigurationsFromAssembly(typeof(HttpRequestLogConfiguration).Assembly);
}
}
// Configure middleware in Program.cs
var app = builder.Build();
// Add HTTP request logging middleware (should be one of the first middleware)
app.FermatHttpRequestLogMiddleware();
// Add other middleware
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
API Endpoints
The library provides the following RESTful API endpoints when EnableApiEndpoints
is set to true:
GET /api/http-request-logs/{id}
- Get specific request log detailsGET /api/http-request-logs/pageable
- Get request logs with filtering and paginationDELETE /api/http-request-logs/cleanup
- Clean up old request logsGET /api/http-request-logs/response-time-stats
- Get response time statisticsGET /api/http-request-logs/slowest-endpoints
- Get the slowest endpoints analysisGET /api/http-request-logs/most-frequent-endpoints
- Get most frequent endpointsGET /api/http-request-logs/status-code-distribution
- Get status code distributionGET /api/http-request-logs/request-rate
- Get request rate over timeGET /api/http-request-logs/error-rate
- Get error rate over timeGET /api/http-request-logs/client-usage
- Get client usage statisticsGET /api/http-request-logs/total-count
- Get total log count
DTOs
HTTP Request Logs
HttpRequestLogResponseDto
: Detailed request log informationGetListHttpRequestLogRequestDto
: Filtering and pagination options
Performance Analysis
ResponseTimeStatsRequestDto
: Response time statistics parametersResponseTimeStatsResponseDto
: Response time statistics resultsEndpointPerformanceResponseDto
: Endpoint performance resultsEndpointUsageResponseDto
: Endpoint usage results
Rate Analysis
RateOverTimeRequestDto
: Rate analysis parametersDefaultRateOverTimeResponseDto
: Request rate resultsErrorRateOverTimeResponseDto
: Error rate results
Client Analysis
ClientUsageStatsResponseDto
: Client usage statisticsDateRangeRequestDto
: Date range parameters
Enums
TimeInterval
: Time interval options (Minute, Hour, Day, Week, Month)SortOrderTypes
: Sorting order options (Asc, Desc)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.1)
- Fermat.EntityFramework.Shared (>= 0.0.1)
- FluentValidation.DependencyInjectionExtensions (>= 11.11.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.EntityFrameworkCore (>= 9.0.7)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.7)
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 |
---|---|---|
0.0.1 | 115 | 7/28/2025 |