Docker搭建并启动Logstash的实现方式

  input {

  jdbc {

  jdbc_driver_library => "http://www.jb51.net/pipeline/mysql-connector-java-5.1.46.jar"

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

  jdbc_connection_string => "jdbc:mysql://localhost:3306/datebasename"

  jdbc_user => "root"

  jdbc_password => "123456"

  schedule => "* * * * *"

  statement => "SELECT * FROM table_name"

  use_column_value => true

  tracking_column_type => "timestamp"

  tracking_column => update_time

  last_run_metadata_path => "syncpoint_c_order"

  }

  }

  filter {

  json {

  source => "message"

  remove_field => ["message"]

  }

  }

  output {

  elasticsearch {

  hosts => ["192.168.0.1"]

  user => ""

  password => ""

  index => "index_name"

  document_id => "%{数据库主键}"

  }

  stdout {

  codec => json_lines

  }

  }