Run xml filter on fields created in ruby


(Sharon Sasporta) #1

While handling a huge log,
I am running ruby code filer and according to some rules, I am creating new fields to the event: Object1, Object2, etc.... .
The Number of Objects is according to the input in the event, but during scanning the event I also counting them.

In the end of the ruby filter, I have a parameter holding the number of Object fields and the Objects fields themselves.

For example:
I can have a field: objectsCounter with the value 4 and I will have Object1 .. Object4 fields too.

On each of the Object1 .. Object4 fields, I need to run xml filter.

How can I do it in loop? Or run the xml filter via Ruby?

Regards,
Sharon.


(Walker) #2

Can you post an example of what your data looks like after ruby has processed it?


(Sharon Sasporta) #3

I don't think it is relevant how my xml objects look like.

What is relevant is the problem how to loop on known number of ObjectX (Object1 ... ObjectsN) and run the xml filter on them one by one.

I think that solution is to run the XML filter in the ruby, during these Obects are created.

For that I installed nokogiri ruby gem and in my conf file I wrote:

event.set("Object"+(objindex-1).to_s, Nokogiri::XML.parse((function_array[objindex].to_s).split("\n").last.strip))*

It still not working.

How do I connect it to Logstash? Do I need to do something special?

Thanks
Sharon.


(system) #4

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