Write ruby filter method in class


(Pradeep Reddy) #1

Hi,

I have to map the keys in event to other fields which comes from external configuration .

my event:

     "id" => 10,
"updated_on" => 2018-01-03T03:17:56.000Z,
      "name" => "ggd",
      "type" => "mysql_read"

for one of the type i wanted to replace id with id_new for other type i wanted to replace id with id_new_2

how can achieve this ? is there any already existing filter plugin which supports this

-- what i tried

created a mapping class whcih maps to fileld based on type all the mappings are instances variables .

class Mapping

@@mysql_read_id=id_new
@@mysql_read_name=first_name

end

is it possible to read this class level variables in my ruby filter method .

please help me


(Guy Boertje) #2

You will need to explain a bit more of your general problem with actual sample data.

I suspect that you can use the translate filter.

Very few people need to resort to using class variables in a ruby filter.


(system) #3

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