Skip to content
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

With maxfiles and maxsize options, older timestamped log files are not removed #46

Closed
kumar-b opened this issue Jun 16, 2016 · 8 comments

Comments

@kumar-b
Copy link

kumar-b commented Jun 16, 2016

When maxfiles option is set, for current timestapmed logfiles, it removes the oldfiles. For ex: if maxfiles=2 and pattern=.dd then on third rollover it will have logfile.01.log and logfile.01.log.1, Here it is deleting logfile.01.log and creating logfile.01.log.2

But if based on time rotation happens, it creates new timestamped log files say logfile.02.log, then it has no history of what files are there from previous timestamp. And it's not removing them.
Here in code
https://github.com/winstonjs/winston-daily-rotate-file/blob/master/index.js#L588
it removes only files having current timestamp in the name.

How should we proceed from here? Should we keep a list of all existing log files and remove one when creating new?

@markjbyrne81
Copy link
Contributor

markjbyrne81 commented Jul 12, 2016

I might not be following you correctly but I have just created pull request #50 that I believe may provide the functionality that you're looking for.

@mattberther
Copy link
Member

@kumar-b Can you please review the latest code and see if @markjbyrne81's PR (#50) fixes things?

@kumar-b kumar-b changed the title With maxfiles options, older timestamped log files are not removed With maxfiles and maxsize options, older timestamped log files are not removed Aug 4, 2016
@kumar-b
Copy link
Author

kumar-b commented Aug 4, 2016

The reported issue occurs when both maxfiles and maxsize are set. Hopefully that is a valid scenario. The PR has fixed one part when only maxfiles is set. Now we have to combine both.

I guess the issue title was misleading. I have changed it now.

@KulykOleg
Copy link

Faced with same problem. Will be awesome to implement combination of both. Thanks.

@rootical
Copy link

Having exactly same problem on this end. Would be great to see this working since it is kind of a valid scenario.

@cronon
Copy link

cronon commented Aug 9, 2017

have anyone fixed this or found workaround?

@mattberther
Copy link
Member

Is this still an issue with the new option introduced with #83?

@mattberther
Copy link
Member

Some long-overdue refactoring of the transport has occured. A PR is available at #107. Also, a pre-release version has been published to npm. Please npm install [email protected] and reopen this issue if the problem remains.

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

No branches or pull requests

6 participants