Logstash Plugin Modifying Files

Is it possible for a logstash plugin to modify files (delete/create) in a directory. The goal is to create a mutex.

I've created a Cloud Foundry plugin for logstash that uses the Cloud Foundry CLI. The CLI can only be used by a single process at a time, so if I have multiple logstash processes running on a single VM and they both receive a Cloud Foundry log, only one of them gets processed correctly.

I want to create a locking system so when one process starts to use the Cloud Foundry plugin, the other will wait until it's finished. My first go around is to have a file act as the key. However, I've been having a difficult time creating/deleting files from within the plugin code.

Is it possible for a logstash plugin to modify files (delete/create) in a directory.

Yes. It's standard Ruby code. No operations are prevented by sandboxing or similar.