so in this case if ('GateWay Operation') == 'PAYMENT '"Id" it will be message[3] ok then if EXCEPTION in log_message"DETAIL EXCEPTION" this will be message[4], right?
Ok now imagine ('GateWay Operation') != 'PAYMENT' and EXCEPTION in log_message so in this case "DETAIL EXCEPTION" will be in message[3] not 4. so imagine I have so a lot if condition like this that's why i am using this but i don't know if i can optimize my code.
I understand now why you cannot use a csv filter, but I would do it all in one ruby filter.
ruby {
code => '
m = event.get("message").split("|")
# .shift removes the first value in an array and returns it
event.set("DateTime", m.shift)
event.set("version", m.shift)
event.set("GateWay Operation", m.shift)
if event.get("GateWay Operation") == 'PAIEMENT '
event.set("Id", m.shift)
end
if event.get("log_message").include?("EXCEPTION")
event.set("DETAIL EXCEPTION", m.shift)
end
'
}
Wow i liked this one thank you very much @Badger last thing please about the if statement too
ruby {
code => "if #the rest of the pipe is == 5 blocks
event.set('Status', m.shift)
event.set('Code', m.shift)
end"
}
if the rest of the pipeline = 5 I'm new to ruby filter so I'm not good at ruby filter syntax sorry about that. and I don't know if it's possible to verify the rest of the pipeline.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.