Sql server db error log data export to logstash


(prosenjit biswas) #1

Hi, I have a db table in sql server which logs the errors and maintains in a table. I want to be able to send it to elastic search after parsing it through logstash. Now the problem is the server points to a different port number while logstash tries to establish a connection on default 1433.
Here is how my logstash config looks like.

input {
jdbc {
jdbc_driver_library => "C:\confidential\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://s1wew.abccorp.netnet,20486;user=dummyuname;password=dummypasswpord;"
jdbc_user => ""
jdbc_password => "
"
statement => "SELECT *
FROM [EMEAData].[dbo].[ServicesTransactionErrorLog]"
}
}

filter {

}

output {

stdout { codec => rubydebug }
elasticsearch {
hosts => "127.0.0.1"

index => "logstash=-%{+YYYY.MM.dd}"

}
}


(Magnus B├Ąck) #2

At least according to http://stackoverflow.com/a/25456677/414355 that's not what a SQL Server connection string for JDBC should look like. Anyway, Logstash doesn't care about the connection string or port numbers. It just passes the connection string to the JDBC library.


(prosenjit biswas) #3

I am sorry, I forgot to mention the database name in the connectionstring. Works for me now. @magnusbaeck Thank you for the quick response


(system) #4

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