# Logstash Ruby Tmp Folders - Temporary Solution

**URL:** <https://discuss.elastic.co/t/logstash-ruby-tmp-folders-temporary-solution/283793>\
**Category:** Logstash\
**Created:** [September 9, 2021, 2:38pm UTC](https://discuss.elastic.co/t/logstash-ruby-tmp-folders-temporary-solution/283793 "2021-09-09T14:38:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tydorius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tydorius/32/88729_2.png) [@Tydorius](https://discuss.elastic.co/u/Tydorius)\
**Post date:** [September 9, 2021, 2:38pm UTC](https://discuss.elastic.co/t/logstash-ruby-tmp-folders-temporary-solution/283793/1 "2021-09-09T14:38:55Z")

</div>

I am currently experiencing the [known issue](https://github.com/elastic/logstash/issues/11051) 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](https://crontab.guru/every-12-hours).

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 7, 2021, 2:39pm UTC](https://discuss.elastic.co/t/logstash-ruby-tmp-folders-temporary-solution/283793/2 "2021-10-07T14:39:03Z")

</div>

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