serilog-mssql / serilog-sinks-mssqlserver

A Serilog sink that writes events to Microsoft SQL Server and Azure SQL
Apache License 2.0
283 stars 148 forks source link

How to delete data by configuring serilog? #592

Closed gao-chao-2020 closed 3 weeks ago

gao-chao-2020 commented 4 weeks ago

Hello, may I ask how to clear historical data from 30 days ago? I always execute SQL to delete data. Is there a way to delete data by configuring serilog?

jonorossi commented 4 weeks ago

Take a look at #221 and #519.

ckadluba commented 3 weeks ago

We even had a PR once where someone put significant effort into adding this as a feature to our MSSQL sink. During the PR review and discussing the feature we had more and more doubts if adding such a feature could cause more questions and problems in practice than it would help. In the end we decided against adding it and our recommendation is to use tools and features of SQL Server/Azure SQL to clean up old logs like stored procedures, triggers or database jobs.