欢迎光临
感受代码之美

logstash 7配置jdbc插件

logstash.jpg

环境

  • logstash-7.1.1.rpm;
  • elasticsearch-7.1.1-linux-x86_64.tar.gz;

配置

1.配置文件

input {
  jdbc {
    jdbc_driver_library => "/home/inspur/elasticsearch/lib/ojdbc6.jar"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@10.47.0.238:1521:orcl"
    jdbc_user => "lgzr"
    jdbc_password => "lgzr"
    statement => "select * from SR_INFOR t"
    clean_run => true
  }
}

output {
   elasticsearch {
      hosts => ["10.47.0.96:9200"]
      index => "data_archives_jdbc"
   }
}

2.测试配置文件

sudo /usr/share/logstash/bin/logstash  -f /etc/logstash/conf.d/ --config.test_and_exit --path.settings=/etc/logstash

启动logstash

sudo /usr/share/logstash/bin/logstash  -f /etc/logstash/conf.d/ --path.settings=/etc/logstash

进阶

更详细的配置,参考我的这篇文章:记一次logstash 7配置jdbc插件使用实践

转载请注明来源:四个空格 » logstash 7配置jdbc插件

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址