Hi,
I am reading a log file where I have key value paired events. I extract the key value fields using KV filter and then construct a JSON manually like the below.
I have a requirement where in the elementDetail in the schema can only be an array and hence the JSON generated out of this is throwing schema error.
I tried using [DetailSection][elementDetail][0][rejectCode], "[DetailSection][elementDetail][0][rejectReasonDescription]", but they dont work the intended way.
Depending on whether you want the array to contain a single object or multiple objects...
ruby {
code => "
a = []
h = Hash.new
event.to_hash.each { | k, v |
if k == 'rejectCode' || k == 'rejectReasonDescription'
# For an array where each entry contains a single object has use this instead
#a << { k => v }
h[k] = v
end
}
a << h
event.set( '[DetailSection][elementDetail]', a)
"
}
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.