在logstash配置文件下执行以将oracle表转换为elasticsearch,请使用JDBC输入插件找到我的下面的logstash配置文件。
input {
jdbc {
jdbc_driver_library => "D:\1SearchEngine\data\ojdbc8.jar"
jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:@localhost:1521:XE"
jdbc_user => "demo"
jdbc_password => "1234567"
statement => 'select vp.id,
LISTAGG(vp.code,',')within GROUP (order by vp.code) "CODE",
LISTAGG(vbl.product_id,',')within GROUP (order by vbl.product_id) "PRODUCT_ID",
LISTAGG(vbl.type,',')within GROUP (order by vbl.type) "TYPE"
from product vp,PRODUCT_LINK vbl
where vp.id = vbl.product_id
group by id,vbl.product_id,vbl.type'
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "replacement"
}
}
执行配置文件时遇到以下错误
Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, {, } at line 9, column 27 (byte 308) after \tinput {\n\t jdbc
使用logstash 6.2.4版本
在第一个单引号select vp.id,LISTAGG(vp.code,',')