Chemse
(Taloub)
August 11, 2017, 12:21pm
1
Hello,
I want to calculate number of days between two dates in logstash
I have :
date {
match => ["Deb","dd/MM/YYYY"]
target=> "Deb"
}
date {
match => ["toDay","dd/MM/YYYY"]
target=> "toDay"
}
and I did this Ruby filter but it doesn't work !!
ruby {
init => "require 'time'"
code => "event['duree'] = event['toDay'] - event['Deb'];"
}
Can you help me please
Chemse
(Taloub)
August 11, 2017, 1:07pm
2
Solved by doing this
ruby {
code => "event.set('duree', (event.get('toDay') - event.get('Deb'))/3600/24)"
}
first I got the period on secondes so I convert it to days
good luck
2 Likes
system
(system)
Closed
September 8, 2017, 1:07pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.