input {stdin {} jdbc {#MySQL JDBC connection string to our backup databseJdbc_connection_string ="Jdbc:mysql://localhost:3306/userdb?useunicode=true&characterencoding=utf-8&usessl=false" #The user we wish to excute our statement asJdbc_user ="User"Jdbc_password="Pass" #The path to our downloaded JDBC driverJdbc_driver_library ="Mysql-connector-java-5.1.40-bin.jar" #The name of the driver class for MySQLJdbc_driver_class ="Com.mysql.jdbc.Driver"jdbc_paging_enabled="true"jdbc_page_size="50000"Statement_filepath="Mysqltestsql.sql"Schedule="* * * * *"type="JDBC"Use_column_value=true Tracking_column=ID Last_run_metadata_path="C:\logstash-5.2.0\bin\last_run_metadata_path\last_run_metadata_path"}}filter {json {source="message"Remove_field= ["message","_id"]}}output {elasticsearch {action="Index"hosts= ["http://localhost:9200"] Index="MYSQLTESTDB2" #index = "User"Workers = 1 } #stdout { #codec = Rubydebug #codec = Json_lines #}}
Mysqltestsql.sql
Select from WHERE > : Sql_last_value
Logstash How to import Elasticsearch from MySQL via JDBC