Serilog.Viewer
1.2.0
dotnet add package Serilog.Viewer --version 1.2.0
NuGet\Install-Package Serilog.Viewer -Version 1.2.0
<PackageReference Include="Serilog.Viewer" Version="1.2.0" />
<PackageVersion Include="Serilog.Viewer" Version="1.2.0" />
<PackageReference Include="Serilog.Viewer" />
paket add Serilog.Viewer --version 1.2.0
#r "nuget: Serilog.Viewer, 1.2.0"
#:package Serilog.Viewer@1.2.0
#addin nuget:?package=Serilog.Viewer&version=1.2.0
#tool nuget:?package=Serilog.Viewer&version=1.2.0
<div align="center"> <img src="src/Serilog.Viewer.React/src/log-viewer-icon.png" alt="Serilog.Viewer" width="120" /> <h1>Serilog.Viewer</h1> <p>A lightweight, embeddable log viewer for ASP.NET Core applications using Serilog structured logging.<br/>Browse, filter, and search log files through a modern React UI — served directly from your running application.</p>
Screenshots
Features
- Dashboard — at-a-glance stats with charts for errors, warnings, and log volume over time
- Log Explorer — paginated log browser with full-text search, level filtering, and date range selection
- Live Tail — real-time streaming of new log entries via SignalR (optional add-on)
- Multiple log formats — parses plain-text (
.log/.txt) and CLEF compact JSON (.clef/.json) - Basic Authentication — optional username/password gate for the
/logviewerroute - Multi-framework — targets .NET 8 and .NET 9
Packages
| Package | NuGet | Description |
|---|---|---|
Serilog.Viewer |
Core middleware, log reading, and React UI | |
Serilog.Viewer.Realtime |
(coming soon) | Optional SignalR extension for live log tailing |
Getting Started
1. Install the NuGet package
dotnet add package Serilog.Viewer
2. Configure Serilog to write log files
Log.Logger = new LoggerConfiguration()
.WriteTo.File(
new CompactJsonFormatter(),
"Logs/log-.clef",
rollingInterval: RollingInterval.Day)
.CreateLogger();
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseSerilog();
3. Register services and map middleware
builder.Services.AddLogViewer(options =>
{
options.LogFolder = "Logs";
});
var app = builder.Build();
app.UseLogViewer();
app.Run();
4. Open the viewer
Navigate to /logviewer in your browser.
Configuration
All options are set via the LogViewerOptions lambda passed to AddLogViewer:
| Option | Type | Default | Description |
|---|---|---|---|
LogFolder |
string |
"Logs" |
Path to the folder containing Serilog log files |
BasePath |
string |
"/logviewer" |
URL base path for the UI and API |
EnableBasicAuth |
bool |
false |
Protect the viewer with HTTP Basic Authentication |
Username |
string? |
null |
Username for Basic Auth (required when enabled) |
Password |
string? |
null |
Password for Basic Auth (required when enabled) |
AuthRealm |
string |
"Log Viewer" |
Realm shown in the browser's auth challenge dialog |
EnableFileDownload |
bool |
true |
Allow downloading log files from the viewer UI and API |
EnableFileDelete |
bool |
false |
Allow deleting log files from the viewer UI and API |
Example — custom path and Basic Auth
builder.Services.AddLogViewer(options =>
{
options.LogFolder = Path.Combine(AppContext.BaseDirectory, "Logs");
options.BasePath = "/admin/logs";
options.EnableBasicAuth = true;
options.Username = "admin";
options.Password = "s3cr3t";
});
Real-time Log Tailing
Install the optional SignalR add-on:
dotnet add package Serilog.Viewer.Realtime
Chain .AddLogViewerRealtime() onto the builder:
builder.Services.
.AddLogViewer(options => { options.LogFolder = "Logs"; })
.AddLogViewerRealtime();
A Live Tail tab will appear in the UI. No SignalR client code is required — the bundled React app handles it automatically. Applications that do not call AddLogViewerRealtime incur zero SignalR overhead.
Supported Log Formats
| Extension | Format | Parser |
|---|---|---|
.clef |
Compact Log Event Format (CLEF / JSON) | ClefLogParser |
.json |
Compact Log Event Format (CLEF / JSON) | ClefLogParser |
.log |
Plain-text Serilog output template | PlainTextLogParser |
.txt |
Plain-text Serilog output template | PlainTextLogParser |
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes following Conventional Commits:
git commit -m "feat: add my feature" - Push to your fork:
git push origin feature/my-feature - Open a Pull Request against
main
Building locally
# Backend
dotnet build
# Frontend (inside src/Serilog.Viewer.React)
npm install
npm run build
Run the sample host to see the viewer in action:
dotnet run --project src/SampleHost
# then visit http://localhost:<port>/logviewer
License
MIT © Sreejith — see LICENSE for details.
| 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 is compatible. 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. |
-
net8.0
- Microsoft.Data.Sqlite (>= 10.0.8)
-
net9.0
- Microsoft.Data.Sqlite (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.