简体   繁体   English

如何配置logstash以将数据从MS-SQL服务器传输到elasticsearch

[英]How to configure logstash to transfer data from MS-SQL server to elasticsearch

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 : 我试图将我的表数据从MSSQL服务器复制到elasticsearch,经过一些文档之后,我为logstash编写了配置文件,当我从命令提示符运行该文件时,我收到此消息:

"J_3a_.ELK.logstash_minus_6_dot_6_dot_2.logstash_minus_core.lib.logstash.pipeline.block in start_input" “ start_input中的J_3a_.ELK.logstash_minus_6_dot_6_dot_2.logstash_minus_core.lib.logstash.pipeline.block” 命令行截图 I have the MSSQL database in aws-RDS. 我在aws-RDS中拥有MSSQL数据库。

This is my conf file 这是我的conf文件

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. 我似乎无法明白这里出了什么问题,我在conf文件中提供了必要的详细信息,命令行显示了以上消息。 I have tried removing the username and password from the connection string. 我尝试从连接字符串中删除用户名和密码。 Help!! 救命!!

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}"
 }

   }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM