1

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 ?

  • 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 Answers1

3

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.

jayhendren
  • 8,384
  • 2
  • 33
  • 58