Multi log-table support?
See original GitHub issueHiya,
I’ve got the following setup, where i have 2 webapis and 1 hangfire backouground service running. They all log to different tables with serilog’s MSSQL sink:
I’d love if the ui would support multiple services in some way.
I imagine something like:
services.AddSerilogUi(options => options.UseSqlServer(_defaultConnectionString, "WebApi", "AppLogs"));
services.AddSerilogUi(options => options.UseSqlServer(_defaultConnectionString, "AuthApi", "AppLogs"));
services.AddSerilogUi(options => options.UseSqlServer(_defaultConnectionString, "Hangfire", "AppLogs"));
...
app.UseSerilogUi(x => x.Endpoint("/applogs/webapi"));
app.UseSerilogUi(x => x.Endpoint("/applogs/authapi"));
app.UseSerilogUi(x => x.Endpoint("/applogs/hangfire"));
But that doesn’t work since UseSqlServer
registers a singleton that is used for any SqlServerDataProviders:
((ISerilogUiOptionsBuilder) optionsBuilder).Services.AddSingleton<RelationalDbOptions>(implementationInstance);
.
I could also use one single logging table for all services, but then i’d need to be able to filter per application (an enrichter and a way to filter a spec. log property?).
Any ideas?
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Tree Log Table Base - Etsy
Beautiful sanded Teak Wood log base, great for use as a stool, coffee table with glass top, end table, solid wood furniture, ready...
Read more >table base for glass top dining table - Amazon.com
Design 59 Metal Dining Table Legs, Table Base for Desk, Kitchen, Restaurant & ... Powell Natural Wood Glass Top Parnell X Base Dining...
Read more >How To: Log Slice Side Table - YouTube
Follow along as I make a side table out of a slice off an old red oak log.The legs are steel, 1"x1" square...
Read more >How To Build a Solid Wood Table Top - YouTube
Subscribe now and never miss a new video! In this video you'll learn How To Build a Solid Wood Table Top from a...
Read more >Wholesale wood multi table For Amazing Dining Settings
You can shop for wood multi table at Alibaba.com to get beautiful dining tables with designs. Find wholesale wood multi table here to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hiya,
I myself was thinking more in the line of registering multiple providers or services, i don’t feel like a provider should be able to handle multiple tables, its only there to provide data.
Just cloned the repo so ill take a stroll through the code, your solution seems very easy to implement so perhaps thats a good way to move forward.
2 unrelated remarks:
UseMySqlServer
its a public method and part of the lib interface so i’d suggest creating an override or adding optional properties so you don’t break the interface and library consumers dont have to update code unnecesarily - i understand this is just a proto ofc.Here’s a sample project to emulate the situation, one console app with 3 mssql sinks all pushing to 3 different tables.
SerilogUiMultiDbSample.zip
EDIT: Oops - thats a normal net core project - not ASP. I read over that. The exact same code can be applied to an asp net core project though - is this ok for you?