Skip to content

Instantly share code, notes, and snippets.

@diloabininyeri
Created March 15, 2023 08:52
Show Gist options
  • Save diloabininyeri/88da4872782bf64763d86a6038cec5ec to your computer and use it in GitHub Desktop.
Save diloabininyeri/88da4872782bf64763d86a6038cec5ec to your computer and use it in GitHub Desktop.
logstash input mysql and output mysql
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/database_name"
jdbc_user => "admin"
jdbc_password => "admin"
jdbc_driver_library => "/home/log-stash/drivers/mysql-connector-java-8.0.25.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "SELECT * FROM my_table_input WHERE id > :sql_last_value ORDER BY id ASC limit 1"
tracking_column => "id"
tracking_column_type => "numeric"
use_column_value => true
schedule => "* * * * * *"
}
}
output {
stdout{
}
jdbc{
driver_jar_path => "/home/log-stash/drivers/mysql-connector-java-8.0.25.jar"
driver_class => "com.mysql.jdbc.Driver"
connection_string => "jdbc:mysql://127.0.0.1:3306/database_name"
username => "admin"
password =>"admin"
statement => ["replace into my_table_output (id,name,created_at,updated_at) values (?,?,?,?)","id","name","created_at","updated_at"]
}
}
@diloabininyeri
Copy link
Author

should install jdbc out via

https://github.com/theangryangel/logstash-output-jdbc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment