问答详情
源自:4-2 logstash全量、增量同步解决方案

网上下载的配置文件换行有问题,分享一份我本地修改后的配置

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 2020-04-23 18:58

个回答

  • 梦编猿
    2020-06-12 15:07:51

    +1~