aini 发表于 2017-12-12 12:13:53

logstash-5.0同步mysql

input {  stdin {
  }
  jdbc {
  # mysql jdbc connection string to our backup databse
  jdbc_connection_string => "jdbc:mysql://localhost:3306/m8"
  # the user we wish to excute our statement as
  jdbc_user => "xuxy03"
  jdbc_password => "xuxy03"
  # the path to our downloaded jdbc driver
  jdbc_driver_library => "E:/data_json/mysql-connector-java-5.1.30.jar"

  # the name of the driver>  jdbc_driver_class => "com.mysql.jdbc.Driver"
  jdbc_paging_enabled => "true"
  jdbc_page_size => "50000"
  
#以下对应着要执行的sql的绝对路径。
  statement_filepath => "E:/data_json/jdbc.sql"
  
#定时字段 各字段含义(由左至右)分、时、天、月、年,全部为*默认含义为每分钟都更新(测试结果,不同的话请留言指出)
  schedule => "* * * * *"
  
#设定ES索引类型
  type => "bd_dev_dlq"
  }
  
}
  

  
filter {
  json {
  source => "message"
  remove_field => ["message"]
  }
  
}
  

  
output {
  elasticsearch {
  
#ESIP地址与端口
  hosts => "localhost:9200"
  
#ES索引名称(自己定义的)
  index => "m8"
  
#自增ID编号
  document_id => "%{id}"
  }
  stdout {
  
#以JSON格式输出
  codec => json_lines
  }
  
}

qwertyqwer 发表于 2017-12-12 12:32:44

感觉就像外语
页: [1]
查看完整版本: logstash-5.0同步mysql