0

This question already has an answer here:

I am running out of disk space with /var system file and noticed /var/log/jenkins/jenkins.log file is occupied 7 GB. Can i safely remove this log file ?

marked as duplicate by Jeff Schaller, roaima, LinuxSecurityFreak, user88036, G-Man Sep 25 '18 at 2:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • this solution is helped me to understand the log files priority and function that related to linux. i would like to know from the prospect of jenkins. i mean by deleting this log file can affect the configuration ? – Shaik Haneef Sep 24 '18 at 14:34
1

The log file is safe to remove if you take the following steps:

  1. Stop Jenkins.
  2. Verify that nothing is holding the log file open with lsof /var/log/jenkins/jenkins.log (should print no output and non-zero exit code).
  3. Do whatever you want with the log file - remove it, truncate it, overwrite it with a blank file, compress it and archive it, etc.
  4. (Optional but recommended) Setup logrotate to ensure that the log file doesn't grow to 7 GB again.
  5. Start Jenkins.

Step 2 is necessary to ensure that you don't end up with any orphaned inodes.

As far as Jenkins is concerned, it doesn't care if you delete the file as long as you do so when Jenkins is not running.

I would also highly recommend looking through the log file, determining what is causing it to grow so large, and coming up with a strategy for reducing unneeded logfile entries.

Not the answer you're looking for? Browse other questions tagged or ask your own question.