BedeGaming / sinks-rollingfile

A serilog sink for rolling files based on size and time
Apache License 2.0
15 stars 20 forks source link

Update File Retention Policy #43

Open ritasker opened 7 years ago

ritasker commented 7 years ago

Fixes #42

Uses pattern matching to select only the files in the directory that have a similar pattern to the current sinks filename.

Moves the file retention code to a common class used by both the HourlyRollingFileSink & AlternateRollingFileSink.

New tests added and pass.

jchannon commented 7 years ago

Hit an issue today that its not deleting files/rolling over files in order. Can we get this merged in and released ASAP please

-rwxr--r-- 1 root root 30720039 Aug 21 21:38 vqservice-20170821-00075.log
-rwxr--r-- 1 root root 30720112 Aug 21 21:42 vqservice-20170821-00078.log
-rwxr--r-- 1 root root 30720035 Aug 21 21:46 vqservice-20170821-00081.log
-rwxr--r-- 1 root root 30720035 Aug 21 21:47 vqservice-20170821-00082.log
-rwxr--r-- 1 root root 30720082 Aug 21 21:58 vqservice-20170821-00089.log
-rwxr--r-- 1 root root 30720163 Aug 21 22:03 vqservice-20170821-00093.log
-rwxr--r-- 1 root root 30720047 Aug 21 22:06 vqservice-20170821-00095.log
-rwxr--r-- 1 root root 30720204 Aug 21 22:13 vqservice-20170821-00100.log
nblumhardt commented 7 years ago

If it helps, I've implemented date/size rolling in: https://github.com/serilog/serilog-sinks-file/pull/35

Needs a review/merge; after that, some help testing the results would be appreciated.