logstash - 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.
解决方案
Can you try the below query.
Select * from mytable where insert_date >
sysdate-24/24 order by insert_date
推荐阅读
- keyman - keyman.setDefaultKeyboardForControl(Pelem, 键盘, languageCode); 函数不适用于 iframe 元素
- shopify - Shopify 商店上的 Klarna Express 按钮
- java - 如何从一个简单的java类调用javacc解析器并执行
- javascript - 防止同时插入大于最大值的值限制为小数
- c# - 每次我按“开始”时,C# autoclicker 都会崩溃
- json - 参数类型'列表
?不能分配给参数类型“列表” ' - mysql - MySQL 在进行数据库备份和迁移时挂断
- pointers - 如何在 C++ 中的 struct 中创建大小未知的动态分配数组
- mongodb - 如何将猫鼬初始化模型与对象数组一起使用
- reactjs - 获取 SyntaxError: Unexpected token while Running react app