Field reference in ruby filter

Is it possible to reference a field inside the ruby filters code?
I have a field with an ID and I would like to create a variable for each of it's values if it has not been created yet, or do something with it, if I already created it.
Something like this:
ruby {
code =>
"if defined? $my_var%{my_ID} == nil
$my_var%{my_ID} = 0;
else
do stuff with $my_var%{my_ID}
end"
}

https://www.elastic.co/guide/en/logstash/current/event-api.html

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