We are using Jenkins (on Linux) to manage our Maven builds.
Our users can create their own job and sometimes (3 or 4 times per year), they are doing a mistake and the job generates a large log file (79 GB the last time...).
I had a look to existing plugins and I didn't find something to monitor the Jenkins log size.
For example, if the log size exceeds 200MB (when the job is running), I would like to automatically stop the build.
If you developed such shell scripts or Jenkins plugins, can you share your solution?
Thanks :)
This is a feature that is given to you by Jenkins so you can change the number of builds you want to keep. If you are using a Declarative pipeline you can just add this to your code: pipeline { options { buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30')) } ... }
You can use the Logfilesizechecker Plugin:
This plugin monitors the size of the output file of a build and aborts the build if the log file gets too big.
Or, if this has also an impact on the runtime, the Build-timeout Plugin:
This plugin allows you to automatically abort a build if it's taking too long. Once the timeout is reached, Jenkins behaves as if an invisible hand has clicked the "abort build" button.
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