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"
schedule => "* * * * *"
statement => "SELECT config.query as query from QueryConfigTable config "
}
}
/// 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"
}
but i want the query value ie, "select * from customertable cust where cust.isdeleted !=0 "to be executed as JDBC input to logstash
So you have a table that has a column that contains another query that you want to execute?
Why?
Might be a better idea to create a stored procedure instead that then puts the queries from the table in a cursor and executes it then, or just put your desired query in the logstash config.
Thank you @AquaX
Yes correct
And I hope Stored Procedure is correct to go further
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.