A tool to automate removal of generated logs after a set amount of time.
npm install log-file-remover
var logRemover = ;logRemover;
The library will accept a custom config object being passed into the schedule function. If no object is passed through then the default config will be used.
If startTheJobAutomatically is set to false, remember to call job.start(), assuming job is the variable you set the cron job to. Unfortunately, for now this is hard coded to true.
For the timeZone if you need others, check the moment-timezone npm module
timeToTake is the time which will be looked at when deleting logs.
timeToTake is either mtime, ctime or fileName. The modified time, the created time or a date specified in the file name.
The filename looked at follows this expression:
cronTime uses standard cron input. This allows for more explicit control of the timed settings of the cron Job
everySecond: '* * * * * *'everyMinute: '* * * * *'everyHour: '00 00 * * * *'every10Seconds: '*/6 * * * * *'midnight: '00 00 00 * *'everyDayAtTwoFifteen: '00 15 02 * * *'