Skip to content

Combining file size limit and rolling days #41

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

Closed
danielwertheim opened this issue Nov 17, 2017 · 4 comments
Closed

Combining file size limit and rolling days #41

danielwertheim opened this issue Nov 17, 2017 · 4 comments

Comments

@danielwertheim
Copy link

What combination should be used to get:

  • Files of max X bytes, when reached, start a new file
  • Keep max 10 days of logs

E.g

MyLog20171101-001.txt
MyLog20171101-002.txt
MyLog20171102-001.txt
MyLog20171102-002txt
MyLog20171102-003.txt
...
MyLog20171110-001.txt
...
Next day, all from 20171101 gets deleted
...
Next day, all from 20171102 gets deleted
...
@Shawn1874
Copy link

I would think that this would do it.

.WriteTo.File("log.txt", fileSizeLimitBytes: <somevalue>, rollOnFileSizeLimit: true, rollingInterval: RollingInterval.Day)

What do you mean by, "Next day, all from 20171101 gets deleted"? I only see 6 files created before that. I don't know what you are asking. I think Serilog will simply stop creating log files when the limit is reached.

@ndrwwlf
Copy link

ndrwwlf commented Aug 2, 2018

retainedFileCountLimt: 10

@nblumhardt
Copy link
Member

I think you're looking for the same thing as #39 - closing as a duplicate. Cheers!

@ndrwwlf
Copy link

ndrwwlf commented Sep 22, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants