-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New file is created every 30 minutes #334
Comments
Hi @Falco20019 |
@yoav-melamed The use case is to wrap the file stream into a To be able to continue writing to this file, you would seek back to that position, and wrap the stream with this IV and re-write the block, returning that stream for further writes. Therefore So I run out of ideas, and avoiding the re-opening (which seems like an unintended side-effect of the recheck if multiple opens fail) would already solve the issue during runtime, while it still is no solution for continuation on startup. #152 shows more details on a similar use-case with some code. I tried to focus in this bug ticket only on the reopening issue. |
@nblumhardt If you could acknowledge that the reopening of non-faulted streams is not intentional, I could offer to work on a PR fulfilling this assumption. I just wanted to wait to not implement something that doesn't fulfill the correct boundary. |
Thanks for checking in @Falco20019.
Unfortunately I'd need to spend some time digging into this; it's possible that the the reopening mechanism currently provides some level of recovery/resilience we'd lose making the change. I agree that the current behavior has some drawbacks 🤔 .. I'll try to loop back this week, unfortunately out of time today. |
Description
Related to #152
If using hooks that do not allow reopening a file, it force-creates a new one every 30 minutes for no real reason.
Reproduction
Use the following hook with a
RollingFileSink
with any big filesize limit (i.e. 1 GB) and inifite interval rolling:Wait for 30 minutes and create a log entry after that (or just reduce the time to 1 millisecond here):
serilog-sinks-file/src/Serilog.Sinks.File/Sinks/File/RollingFileSink.cs
Lines 115 to 117 in 5e3ff41
Due to the checkpoint being checked on the next log being written, it will enforce a reload, leading to the hook failing in this location:
serilog-sinks-file/src/Serilog.Sinks.File/Sinks/File/RollingFileSink.cs
Lines 95 to 108 in 5e3ff41
Expected behavior
The log file will correctly be used until something goes wrong. It will NOT try to reopen the file every 30 minutes and create a new log file messing up the retention.
Relevant package, tooling and runtime versions
Serilog.Sinks.File 6.0.0
but also tried to self-compile it fromdev
Additional context
Due to the issue from #152 it's not possible to reopen files just leasurely. As encryption would need to remove the padding and re-read the IV, it requires
ReadWrite
permission. This needs to be enforced for it to work at all. But due to theRollingFileSink
just setting the next checkpoint to 30 minutes if not needed at all, this leads to the issue of retention deleting needed files. There is currently no workaround possible with encryption enabled and using a rolling file sink right now.Please either fix #152 to support
ReadWrite
or at least make sure that the checkpoint is set in a way that does not reopen the file without need to only run into it on restarts instead of every 30 minutes on runtime :) This will at least hit the retention less as restarts aren't happening often.The text was updated successfully, but these errors were encountered: