简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM