What I would do is to include in the query statement the timestamp of the last time the plugin ran (i.e. sql_last_start
) and so it will only load the newly updated records.
For instance, your jdbc
input plugin would look like this:
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"
jdbc_user => "mysql"
schedule => "* * * * *"
statement => "SELECT * FROM mytable WHERE timestamp > :sql_last_start"
}
}
Make sure to change timestamp
with the name of your field containing the last updated date and mytable
with the real name of your table.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…