【搜索技术】系统中 logstash-input-jdbc 同步时需要多个不同业务的索引

如果我想将a表的内容同步到 y 索引的 a类型下, 将b表内容同步到 y 索引的b类型下,如何配置?
Google了下,看到有博主这样配置

【搜索技术】系统中 logstash-input-jdbc 同步时需要多个不同业务的索引

【搜索技术】系统中 logstash-input-jdbc 同步时需要多个不同业务的索引

但是测试后发现结果并不对!!!
下面是我的配置:

input {

jdbc {

jdbc_connection_string => "jdbc:mysql://localhost:3306/crm?zeroDateTimeBehavior=convertToNull"

jdbc_user => "root"

jdbc_password => ""

jdbc_driver_library => "D:/siyang/elasticsearch-5.2.2/logstash-5.2.2/mysql-connector-java-5.1.30.jar"

jdbc_driver_class => "com.mysql.jdbc.Driver"

jdbc_paging_enabled => "true"

jdbc_page_size => "50000"

statement_filepath => "filename.sql"

schedule => "* * * * *"

type => "jdbc_office"

}

jdbc {

jdbc_connection_string => "jdbc:mysql://localhost:3306/crm?zeroDateTimeBehavior=convertToNull"

jdbc_user => "root"

jdbc_password => ""

jdbc_driver_library => "D:/siyang/elasticsearch-5.2.2/logstash-5.2.2/mysql-connector-java-5.1.30.jar"

jdbc_driver_class => "com.mysql.jdbc.Driver"

jdbc_paging_enabled => "true"

jdbc_page_size => "50000"

statement => "SELECT * from sys_user"

schedule => "* * * * *"

type => "jdbc_user"

}

}

output {

stdout {

codec => json_lines

}

if[type] == "jdbc_office"{

elasticsearch {

hosts => "localhost:9200"

index => "contacts4"

document_type => "office1"

document_id => "%{id}"

}

}

if[type] == "jdbc_user"{

elasticsearch {

hosts => "localhost:9200"

index => "contacts4"

document_type => "user1"

document_id => "%{id}"

}

}

}

回答

大意了!!原因在filename.sql中,这条查询语句在logs中报了异常:[logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::JavaSql::SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp>}。

以上是 【搜索技术】系统中 logstash-input-jdbc 同步时需要多个不同业务的索引 的全部内容, 来源链接: utcz.com/a/82878.html

回到顶部