How can I remove a Jenkins log but keep build?

jenkins

Solution

I saw there is a Delete Log Plugin but I didn't personally use it.

https://wiki.jenkins-ci.org/display/JENKINS/Delete+log+plugin

However in my work I did similar thing by just create another job, which go to the Jenkins master server, sort the builds, pick up the ones that need to be cleaned up, and remove the log file. Should be faily easy to do with any scripting language.

Problem

We have builds that generate a lot of logs. It takes space thus we have to tell Jenkins to remove old builds. It is a problem because we therefore lose the long-term statistics. I am thinking of removing or emptying the "log" file of each build older than a week and tell Jenkins not to delete old build. Is there a clean way of achieving the same ?

Original source