Hello,
I have this string field "time.connected"
Examples:
How do I make this field in a duration field? is there a way to convert this?
Hello,
I have this string field "time.connected"
Examples:
How do I make this field in a duration field? is there a way to convert this?
input {
generator {
message => "00:03:02"
count => 1
}
}
output {
stdout {}
}
filter {
ruby { code => "
duration = event.get('message')
seconds = duration.split(':').reverse.map.with_index.sum do |m, i|
m.to_i * 60 ** i
end
event.set('duration', seconds) " }
}
Output:
"duration" => 182
Thank you @Rios !
© 2020. All Rights Reserved - Elasticsearch
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.