我有一个表,例如 QueryConfigTable,它在一列中保存一个查询,例如,从 customertable 中选择 *。我希望该列中的查询是在 logstash I 中作为 JDBC 的输入执行的查询
它将列查询作为值并存储到 elasticSearch
input {
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/MYDB"
//MYDB will be set dynamically.
jdbc_user => "mysql"
parameters => { "favorite_artist" => "Beethoven" }
schedule => "* * * * *"
statement => "SELECT * from QueryConfigTable "
}
}
/// output as elasticSearch
elasticsearch {
hosts => ["http://my-host.com:9200"]
index => "test"
}
final output is
"_index": "test",
"_type": "doc",
"_source": {
"product": "PL SALARIED AND SELF EMPLOYED",
"@version": "1",
"query": "select * from customertable cust where cust.isdeleted !=0"
}
但我希望查询值,即“select * from customertable cust where cust.isdeleted !=0”作为 JDBC 输入执行到 logstash