ruby {
code => "
statistic = event.get('statistics').split('], ')
statistic.each {
|categories|
category, kv = categories.split('[')
if !kv.nil? and !category.nil?
kv.tr(']', '').split(',').each {
|indicator|
key, value = indicator.split('=')
if !value.nil? and !key.nil?
key = category.tr(':', '_') + '_' + key.tr(' ', '').tr(':', '_')
value = value.tr('%','')
if value =~ (/\d+/)
event.set(key, value.to_i)
else
event.set(key, value)
end
end
}
end
}"
}
it's not perfect, but it creates everything automatically and detect int vs string. Also to help me having every values in a document I've concatenated the category+subcat+key as the name of the field
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.