I am using the below log stash config to fetch the data from MYSQL and pushing into elastic search. How can we configure log stash output to have only the refreshed data from MYSQL into elastic search ? The existing indexed data in Elastic search should get deleted and store the current data retrieved from mysql.
input {
jdbc{
jdbc_connection_string => "jdbc:mysql://localhost:3306/STARWARS"
jdbc_user => "root"
jdbc_password => "starwars"
jdbc_driver_library => "/opt/jdk1.5.0_05/lib/mysql-connector-java-5.0.4-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "Select u_id,build,attempted,total from builds"
"schedule" => "0 */2 * * *"
}
}
output {
stdout {codec => json_lines}
elasticsearch {
"hosts" => "localhost:9200"
"index" => "featurewise_report"
"document_id" => "%{u_id}"
"user" => "elastic"
"password" => "elastic"
}
}