Sources: elastic.co
#configuration File : jdbc-logstash-elasticsearch.conf
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://192.168.56.1:3306/school"
jdbc_user => "root"
jdbc_password => "admin"
jdbc_driver_library => "/opt/logstash-5.0.0/bin/mysql-connector-java-5.1.18-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "select * from student"
}
}
output {
stdout { codec => json_lines}
elasticsearch {
hosts => "localhost:9200"
index => "studs"
document_type => "data"
}
}
#To run logstash : #Logstash should be on path..
logstash -f jdbc-logstash-elasticsearch.conf
Above configuration can be altered(driver, driver library & connection parameters..) and used to port data from mssql to elasticsearch..
faced connection issues while using mssql, hence wrote sample jdbc app to check connection url.. It requires server and instance names separated by double back slash in java program where in logstash config its required just once.