Create new event in ruby


(kanchan) #1

Hi,

I am unable to create new event in filter tab.my configuration file code is:

input {
beats {
port => 5044
}
}

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])
              e = LogStash::Event.new()
              e.set(“Notification”,message)
              yield e                  
              puts e.get('message')
           end
            
        end
                   
    "
}

}

output {

 if [@metadata][type] == "test"{

elasticsearch {
hosts => "something"
index => "test"
user => "elastic"
password => "changeme"
}
}

stdout {
codec => "rubydebug"
}

}


Yield called out of block
(system) #2

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