首页 > 解决方案 > SQL Statement on Logstash JDBC | How do i filter only on the today's inserted rows?

问题描述

In my oracle database i have a column insert_date. On elasticsearch i want to index only the events that are inserted today. Here is my conf:

       jdbc {
            type => "D"
            jdbc_connection_string => "jdbc:oracle:thin:@//xxx.xx.xx.xx:1521/xx"
            jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
            jdbc_user => "xxx"
            jdbc_password => "xx"
            statement  => "select * from mytable where insert_date = TRUNC(SYSDATE)  order by insert_date desc"
            schedule => "0 * * * * *"
            clean_run => true
            last_run_metadata_path => "/data/application/.logstash_jdbc_last_run"
            }

I run this script but keep getting an error on logstash.

标签: logstash

解决方案


Can you try the below query.

Select * from mytable where insert_date > 
sysdate-24/24 order by insert_date

推荐阅读