JDBC Input plugin installation

I have the new Mac M1 Silicon.
I need to get data from MySQL workbench into Elasticsearch.
I came to know that it can be achieved using Logstash, which in turn uses JDBC input plugin for getting data from database into Elasticsearch.
I installed Logstash and Elasticsearch by downloading it from the website.
I ran Elasticsearch first, I created Logstash .conf file for specifying input and output.

I have confusions regarding installation of JDBC input plugin and JDBC driver library.

db.conf file - Logstash

#file : db.conf
input{

	jdbc {

		#connection string to database db
		jdbc_connection_string => "jdbc:mysql://localhost:3306/db"
		#user we wish to execute our statement as
		jdbc_user => "root"
		#user pw
		jdbc_password => "password"
		#the path to our downloaded jdbc driver
		jdbc_driver_library => "mysql-connector-java-8.0.27.jar"
		#the name of the driver class for mysql
		jdbc_driver_class => "com.mysql.jdbc.Driver"
		#query
		statement => "SELECT * from Menu"


	}

}

output{
	#stdout { codec => json_lines }
	elasticsearch {
		#protocol => http
		index => "db"
		document_type => "Menu"
		document_id => "%{ID}"
		hosts => "http://127.0.0.1:9200"
		
	}
}

logstash-input-jdbc is bundled with the default logstash package, you do not need to install it.

jdbc_driver_library should include the full path to the jar file.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.