Logstash Ruby Tmp Folders - Temporary Solution

I am currently experiencing the known issue where JRuby files are not cleaned up in /tmp on CentOS 7.

My temporary resolution has been to set up a cron job to remove these folders. To save others trouble, here is my setup:

I created /tmp/clean.sh, which contains:
find . -type d -name 'jruby*' -mtime +1 -prune -exec rm -rf {} \;

This finds all folders starting with jruby within the tmp folder (Hence the location) older than one day and prunes them. If you have a server that is processing a lot more data, I believe you could swap the +1 for +60s to pick up items older than one minute.

Then, I set up my cron job using sudo to ensure it runs elevated.
sudo crontab -e

Within this file, I have set to run every 12 hours.
0 */12 * * * /tmp/clean.sh

If you have trouble with scheduling cron jobs, I highly recommend crontab.guru. They've listed out all common configurations. For example, the "every 12 hours" page.

Anyway, while I'm not new to command line, I'm still much lighter on experience in Linux than I am with Microsoft systems. So troubleshooting this has taken some time, and I wished to potentially save others that time.

Edit: Note that this doesn't resolve any of the underlying issues if you're having a JRuby related issue, this is solely to clean up the tmp folder.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.