Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fatmali
Created January 27, 2019 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatmali/c860f6046f821208a9af55bec49928c9 to your computer and use it in GitHub Desktop.
Save fatmali/c860f6046f821208a9af55bec49928c9 to your computer and use it in GitHub Desktop.
A logstash config file for ingesting data from MySQL table into Elasticsearch
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/testdb"
# The user we wish to execute our statement as
jdbc_user => "root"
jdbc_password => "123456"
# The path to our downloaded jdbc driver
jdbc_driver_library => "/home/comp/Downloads/mysql-connector-java-5.1.38.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
# our query
statement => "SELECT * FROM testtable"
}
}
output {
stdout { codec => json_lines }
elasticsearch {
"hosts" => "localhost:9200"
"index" => "test-migrate"
"document_type" => "data"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment