How to add a date filter statement into JDBC input?

I have a JDBC input hat looks like this:

  jdbc {
    type => "D"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@//nn.nn.nn.nn:1521/nn"
    jdbc_user => "nn"
    jdbc_password => "nn"
    statement  => "select * from nnn"
    schedule => "0 * * * *"
    clean_run => true
    last_run_metadata_path => "/path/.logstash_jdbc_last_run"

i want my sql query to select only the load of the date. somethining like where insert_date = current_date() and skip the history of the table.

Is it possible to do ?

Thanks

Hi

You might be able to pull it off using environment variables. You'll have to define a variable in your system and capture it from logstash, so your where statement would look like where insert_date = ${TODAY}, and $TODAY is a system variable.

Check this out: https://www.elastic.co/guide/en/logstash/current/environment-variables.html

Hope this helps

Thanks for the answer.
i have set it up like that and it make sens .

let see if it works

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.