是时候用 ES 拯救发际线啦

logstash同步mysql和sqlserver至es没反应

Logstash | 作者 sist | 发布于2019年11月28日 | 阅读数:2233

写了多个jdbc,一个mysql的,一个sqlserver的,配置文件如果只写一个jdbc都正常,但是两个放一起跑就没反应,也不报错。是不是不支持同时用不同的驱动?
input {      
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true"
jdbc_user => "root"
jdbc_password => ""
jdbc_driver_library => "C:\logstash-7.4.2\logstash-core\lib\mysql-connector-java-8.0.18.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement => "select * from blog_content WHERE update_date >= :sql_last_value"
schedule => "* * * * *"
jdbc_default_timezone =>"Asia/Shanghai"
type=>"mysqltest"
}
jdbc {
jdbc_connection_string => "jdbc:sqlserver://127.0.0.1:1433;databaseName=logstashtest;"
jdbc_driver_library => "C:\logstash-7.4.2\logstash-core\lib\mssql-jdbc-6.2.2.jre8.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_user => "sa"
jdbc_password => ""
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement => "SELECT * FROM blog_content WHERE UpdateTime >= :sql_last_value"
schedule => "* * * * *"
jdbc_default_timezone => "Asia/Shanghai"
type=>"sqlservertest"
}

}
output {
if[type] == "mysqltest" {
elasticsearch {
hosts => "127.0.0.1:9200"
index => "blogtest"
document_id => "%{id}"
}
}
if[type] == "sqlservertest" {
elasticsearch {
hosts => "127.0.0.1:9200"
index => "blogtest2"
document_id => "%{Gid}"
}
}
stdout {
codec => json_lines
}
}
已邀请:

要回复问题请先登录注册