How to express today's date in sql in logstash


#1

How should I express today's date in sql in logstash?
I tried this and it doesn't work. It throws error saying cannot convert VARCHAR '%{YYYY.DD.dd}' to DATE.
Please help.

input {
jdbc {
....
statement => "select * from ... where date_col=:'todayDate'
parameters => { "todayDate" => "%{YYYY.DD.dd}" }
....
}
}


(Ry Biesemeyer) #2

It's typically easier to do this using a function that is supported by your database.

e.g., with postgres, if the date_col's type were date, then you could use WHERE date_col=CURRENT_DATE