How to compare date in logstash. I want to compare date with a constant date value. The below code fails in Logstash with ruby exception.
if [start_dt] <= "2016-12-31T23:23:59.999Z"
How to compare date in logstash. I want to compare date with a constant date value. The below code fails in Logstash with ruby exception.
if [start_dt] <= "2016-12-31T23:23:59.999Z"
I finally figured it out. First convert the constant date from string to date using logstash date plugin. Then you can compare this date with your date field.
mutate{
add_field => { "str_dt" => "2016-12-31T23:23:59.999Z"}
}
date {
match => ["str_dt", "YYYY-MM-dd'T'HH:mm:ss.SSSZ"]
target => "constant_date"
}
if [start_dt] <= [constant_date] {
}