Bug: ruby filter does not work with certain input plugin combination

Here is an example where ruby filter breaks down.

ruby filter is not working when input ishttp.
but same ruby filter working when the input is CSV.

does anyone have any idea on this

input {
	  http_poller{
		  urls => {
			 http_request => {
					method => get
					url => "http://echo.jsontest.com/word/ruby"
					
					}
				}
				request_timeout => 300 
				codec => "json"
			  }
	}  

filter { 



    ruby {
     init => "
		require '......'  #declaring custom gem which already comes with package 
		require 'XXXXX_middleware'
     "
     code => "

		url = 'https://reqres.in/api/users/2'

		conn = Faraday.new(url: url) do |faraday|
		  faraday.adapter Faraday.default_adapter
		  faraday.response :json
		end

       response = conn.get(url)
		response.body
		event.set('echo',response.body);
     "
   }

}
output {
}

simple ruby code like below is working with http poller input.

		ruby {
code => 'event.set("xyz", "HEllo World")'
}

But ruby code with Faraday not working

Thanks in Advance....

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