Yield called out of block

Hi,
I use code below in configuration file to create new event,but it is giving exception.

filter {

ruby {
    init => "require 'json'"
    code =>"
         clientValue = event.get('message')
         
         fieldArray = event.get('message').split('> <')
        for field in fieldArray
            field = field.delete '<'
            field = field.delete '>'
            result = field.split(': ')
           if result[0].include?('clientName')
              clientValArr = result[1].split('/')
              puts clientValArr
              event.set(result[0], clientValArr[0])
              new_event = event.clone
              new_event.remove('clientName')                  
              e =  LogStash::Event.new('tim' => result[0])
              yield e
              puts e
              puts new_event
           end
      end
                   
    "
}

}

Duplicate of Create new event in ruby.

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