三人行必有我师

logstash采集filebeat中的数据到mysql中重复

Logstash | 作者 kingen9 | 发布于2021年10月09日 | 阅读数:1854

input {
  beats {
    port => 5555
  }
}
 
output {
   if "mglog" in [tags] {
   stdout{ codec=>rubydebug{}}
    jdbc {
        connection_string => "jdbc:mysql://mysql:3306/test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true"
        username => "mysql"
        password => "3Fc"
        driver_jar_path => "/usr/share/logstash/vendor/jar/jdbc/mysql-connector-java-5.1.49.jar"
        driver_class => "com.mysql.jdbc.Driver"
        statement => ["INSERT INTO interface(executorResult,inParams,apiUrl) VALUES(?,?,?)","executorResult","inParams","apiUrl"]
    }
}
 
已邀请:

要回复问题请先登录注册