0

I am trying to copy my table data from MSSQL server to elasticsearch, after going through some documents i wrote my config file for logstash, when i run the file from command prompt , i get this message :

"J_3a_.ELK.logstash_minus_6_dot_6_dot_2.logstash_minus_core.lib.logstash.pipeline.block in start_input" screenshot from the command line I have the MSSQL database in aws-RDS.

This is my conf file

input {
    jdbc {
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        jdbc_driver_library => "J:\Java\sqljdbc_4.2\enu\jre8\sqljdbc42.jar"
        jdbc_connection_string => 
       "jdbc:sqlserver://skunestdevdb.czdnys4mper2.ap-southeast- 
         2.rds.amazonaws.com;database=skudevusr;user= 
       <my_username>;password=<my_password>"
        jdbc_user => "<my_username>"
        jdbc_password => "<myPassword>#"
        statement => "select * from product"
    }
}
output{
    elasticsearch{
      hosts => ["localhost:9200"]
      index => ["skunest_qa"]
    }
}

I cant seem to get what is wrong here, i have provided necessary details in the conf file, the command line stucks showing above message. I have tried removing the username and password from the connection string. Help!!

2
  • You shouldn't provide username and password in jdbc connectron string when you additionally provide fields jdbc_user and jdbc_password. Can you also start Logsatsh in debug mode --debug and then send logs? Commented Apr 2, 2019 at 10:08
  • @MichaelDz i removed the username and password from the connection string and it still result in the same situation. Commented Apr 2, 2019 at 10:26

1 Answer 1

2

Try this:

input {  
jdbc {
    # SqlServer jdbc connection string to your database, productdb
    #  "jdbc:sqlserver://HostName\instanceName;database=DBName;user=UserName;password=Password" 
    jdbc_connection_string => "jdbc:sqlserver://localhost\SQLExpress;database=productdb;user=sa;password=test@123"
    # The user you want to execute your statement as
    jdbc_user => nil
    # The path to your downloaded jdbc driver
    jdbc_driver_library => "C:/Program Files/sqljdbc_6.0/enu/jre8/sqljdbc42.jar"
    # The name of the driver class for SqlServer
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    # Query for testing purpose
    statement => "SELECT * from product"
}
}
output {  
    elasticsearch {
     hosts => ["localhost:9200"]
     index => "logstash-%{+YYYY.MM.dd}"
 }

   }
Sign up to request clarification or add additional context in comments.

1 Comment

Can I put multiple SQL statements here? if yes, then how?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.