You have two fields called f1 which results in f1 being an array. I renamed the second one to be f11. Then this works:
ruby {
code => '
event.to_hash.each { | k, v|
if v.is_a? String
event.set(k, v.strip)
end
}
'
}
@elasticforme the technique used in the post you linked to does not work because it relies on removing spaces around field delimiting characters. Rahul's data is not delimited, it is all fixed width -- see how every single grok field has a fixed width set using {n}
event.to_hash.each {|k, v| -> get each key-value pair
if v.is_a? string -> if value is a string then
event.set(k, v.strip) -> set key as is, and strip space from value
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.