Ruby snippet to iterate through array results in error "Ruby exception occurred: undefined method `[]' for #<LogStash::Event:0x69068bc1>`"

That's not how you do string interpolation in ruby. sprintf references are a logstash thing, not a ruby thing. Try

event.set("parameter_#{index}", value)

As a point of style I think it would be more common to do

ids = event.get("parameter")
if ids
    ...

thus getting rid of the intermediate variable.