I run the NPM global module Forever on my Node server (on Azure). Always works fine to keep all my projects running.
There is 1 project on my server that perhaps has an issue or something that causes Forever to keep outputting to the log. There are 2 Forever logs that grow rapidly and to huge sizes:
9.7Gb /home/azureuser/.forever/P_lf.log
1.3Gb /home/azureuser/.forever/IEJR.log
Whilst I probably need to find out what's wrong with my project and fix it, I also need to fix this logging problem. My research shows I may need to do something with logrotate to stop this much disk space being used.
Any ideas?
There are 2 moments:
You can edit Your app to log only necessary things and errors (can catch errors to prevent them), so Your logs will be smaller.
You can set cron job to cleanup log files every night (let's say every 03:00 AM):
0 3 * * * truncate -s 0 /home/azureuser/.forever/*.log
or odd days (to be able to keep logs one day for debug purposes):
0 3 * * 1,3,5 truncate -s 0 /home/azureuser/.forever/*.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With