input {
jdbc {
jdbc_driver_library => "F:\Respository\Maven\mysql\mysql-connector-java\8.0.15\mysql-connector-java-8.0.15.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true"
jdbc_user => "root"
jdbc_password => "Mysql.1236121273.."
schedule => "* * * * *"
statement => "SELECT (p.id+pw.id) id,p.id pid,p.first_name,p.last_name,p.age,p.about,pw.id pw_id,pw.wife_name,pw.wife_age FROM person p LEFT JOIN person_wife pw ON p.id = pw.person_id where (p.update_time >=:sql_last_value and p.update_time<now()) or (pw.update_time >=:sql_last_value and p.update_time<now())"
}
}
output {
elasticsearch {
index => "my_index"
document_type => "_doc"
document_id => "%{id}"
hosts => ["localhost:9200"]
}
}
+1~