Reading Serilog logs stored in a database

.net-core c# entity-framework-core serilog

Question

I'm writing a dotnet core application that uses Entity Framework Core and Serilog. I would like to store the logs in a Postgres Database (SQLite when debugging)

I want to be able to pull out the logs from the database through the application so it can be presented in a readable manner, (filtered and searched) but I'm having a hard time finding references to how Serilog stores its data, (I can't even tell if it depends entirely on the Sink, which I suspect it does) which makes me think I'm approaching this problem from the wrong angle.

So if I want to be able to pull out Serilog's logs from a database, (Postgres, but preferably any arbitrary database, if it's possible) how should I go about it?

1
0
10/23/2019 11:34:37 AM

Accepted Answer

Serilog relies on a sink to know how what to do with the data, using a sink like: serilog.sinks.postgresql would handle writing to the database for you, then you'd have to make your own solution for querying and parsing the logs once theyre written.

Link for that sink here: https://github.com/b00ted/serilog-sinks-postgresql

2
10/23/2019 11:58:24 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow