Stop Logstash with a Filter or Ruby-Code

I just tried it and it is not going to work. The ruby exit function just raises a SystemExit exception. logstash catches that and logs a 'Ruby exception occurred' message.

That said, what you can do is

ruby { code => 'Process.kill(15, Process.pid)' }

and the really good news is that logstash catches the SIGTERM and goes through normal shutdown processing. Double cash back bonus!