Axl
Axl

Reputation: 13

Reading Serilog logs stored in a database

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?

Upvotes: 0

Views: 2012

Answers (1)

Coffee
Coffee

Reputation: 402

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

Upvotes: 2

Related Questions