Will variables in ruby filter break with multiple workers?

I'm using the ruby filter to clean up some data and during that cleanup, I create temporary variables and I have a few question on how variables may interfere with each other in a pipeline

If I have multiple workers running simultaneously, will the local variables from a ruby filter in one worker ever interfere with another worker?

ruby {
  code => '
  a = event.get("field")
  event.set("b", a)

If we imagine two logs going through logstash , one with field:"foo" and the other with field:"bar", will the field b ever get switched by accident by logstash? Or does logstash separate the contexts of each worker so that a cross over could never occur?

No, not if you use a locally scoped variable name like 'a'. More details here.

Awesome thanks!

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