# Sql server db error log data export to logstash

**URL:** <https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340>\
**Category:** Logstash\
**Created:** [January 31, 2017, 10:29am UTC](https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340 "2017-01-31T10:29:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prosenjit](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@prosenjit](https://discuss.elastic.co/u/prosenjit)\
**Post date:** [January 31, 2017, 10:29am UTC](https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340/1 "2017-01-31T10:29:21Z")

</div>

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

}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 1, 2017, 6:51am UTC](https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340/2 "2017-02-01T06:51:22Z")

</div>

At least according to [http://stackoverflow.com/a/25456677/414355](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.

---

<div class="post-metadata">

**Author:** ![prosenjit](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@prosenjit](https://discuss.elastic.co/u/prosenjit)\
**Post date:** [February 3, 2017, 6:08am UTC](https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340/3 "2017-02-03T06:08:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 3, 2017, 6:09am UTC](https://discuss.elastic.co/t/sql-server-db-error-log-data-export-to-logstash/73340/4 "2017-03-03T06:09:28Z")

</div>

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