Problem : Deletion of log folder with below details
Log size is around 10gb
No . of files around 9k files.
Simple rm -rf log folder doesn't works well.
If you are not using log4j: If you are looking to delete the files for good then there is not many options available other than rm -rf; however there are few tweaks that you can do to make it faster
nohup rm -fr app1-2016* > /tmp/nohup.out 2>&1 &
nohup rm -fr app1-2015* > /tmp/nohup.out 2>&1 &
If using log4j: You should probably be 'DailyRollingFileAppender" with 'maxBackupIndex' - this will essentially limit the max file size of your log and then purge the older contents. More details here: http://www.codeproject.com/Articles/81462/DailyRollingFileAppender-with-maxBackupIndex
Outside of this, you should consider the below 2 things for future use cases
Hopefully this helps. If it does, please 'accept' and 'upvote' the answer. Thank you!!
View solution in original post