2016-05-31 89 views
0

我想連接到數據庫從sql提取數據與logstash;我的服務器名稱是WIN-07LLQEN2SJB \ SQLEXPRESS。當我運行logstash配置文件時,它會返回數據庫連接錯誤。想問問任何人是否有想法。非常感謝提前。與Logstash數據庫連接錯誤

input { 
    jdbc { 
    jdbc_driver_library => "C:\Users\Administrator\Downloads\Microsoft JDBC Driver 4.2 for SQL Server\sqljdbc_4.2\enu\sqljdbc42.jar" 
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    jdbc_connection_string => "jdbc:sqlserver://localhost:1433/WIN-07LLQEN2SJB\SQLEXPRESS;user=sa;password=*****" 
    jdbc_user => "sa" 
    jdbc_password => "*****" 
    schedule => "* * * * *" 
    statement => "SELECT database_id, name, data_used_size, log_used_size FROM DISK.dbo.disk_activity" 
    jdbc_paging_enabled => "true" 
    jdbc_page_size => "50000" 
    } 
} 
filter { 
} 
output { 
    stdout { 
    codec => rubydebug 
    } 
    elasticsearch_http { 
    host => "localhost" 
    index => "sql" 
    } 
} 
+0

什麼是你的數據庫運行在主機名和端口? – Val

+1

主機名稱應爲WIN-07LLQEN2SJB,端口應爲1433,默認值爲。我試圖關閉防火牆。 –

回答

2

this,我覺得jdbc_connection_string應該

jdbc_connection_string => "jdbc:sqlserver://WIN-07LLQEN2SJB\SQLEXPRESS:1433;user=sa;password=*****" 
+0

是的,我已經解決了,謝謝 –

+0

真棒,很高興它幫助! – Val

+0

你還喜歡看看這個? [使用logstash窗口收集網絡操作數據](http://stackoverflow.com/questions/37537373/collect-network-operation-data-with-logstash-windows) –