# Sqlserver logstash configration

**URL:** <https://discuss.elastic.co/t/sqlserver-logstash-configration/71029>\
**Category:** Logstash\
**Created:** [January 10, 2017, 7:20am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029 "2017-01-10T07:20:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElsayedAwd](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@ElsayedAwd](https://discuss.elastic.co/u/ElsayedAwd)\
**Post date:** [January 10, 2017, 7:20am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/1 "2017-01-10T07:20:08Z")

</div>

I have windows as well as Elasticsearch 5.1.1 , I made these configuration with sqlserver and logstash .

**`please what is the error of these configurations .`**

> input {  
> jdbc {  
> jdbc\_driver\_library =\> "D:\Usefull\_Jars\sqljdbc4-4.0.jar"  
> jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
> jdbc\_connection\_string =\> "jdbc:sqlserver://192.168.8.111:1433;databaseName= **;integratedSecurity=false;user=** ;password=\*\*\*\*;"  
> jdbc\_user =\> "team"  
> jdbc\_password =\> "team"  
> statement =\> "SELECT \* FROM [Sourcing].[direct\_feed].[WE\_ExtractedRawData] "  
> }  
> }  
> output {  
> elasticsearch {  
> host =\> "localhost:9200"  
> index =\> "RawData"  
> document\_type =\> "DirectFeed"  
> document\_id =\> "%{ID}"  
> protocol =\> "http"  
> }  
> stdout { codec =\> rubydebug }  
> }

---

<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:** [January 10, 2017, 7:24am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/2 "2017-01-10T07:24:03Z")

</div>

It's completely impossible to help unless you tell us what the problem is. In what way isn't the configuration working? Are you getting an error message?

---

<div class="post-metadata">

**Author:** ![ElsayedAwd](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@ElsayedAwd](https://discuss.elastic.co/u/ElsayedAwd)\
**Post date:** [January 10, 2017, 7:30am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/3 "2017-01-10T07:30:39Z")

</div>

thank you for your fast replying 🙂

**yes I have these errors**

```
> 09:28:35.275 [LogStash::Runner] ERROR logstash.outputs.elasticsearch - Unknown s
> etting 'host' for elasticsearch

> 09:28:35.275 [LogStash::Runner] ERROR logstash.outputs.elasticsearch - Unknown s
> etting 'protocol' for elasticsearch

> 09:28:35.306 [LogStash::Runner] ERROR logstash.agent - fetched an invalid config
> {:config=>"input {\n jdbc {\n jdbc_driver_library => \"D:\\Usefull_Jars\\sq
> ljdbc4-4.0.jar\"\n jdbc_driver_class => \"com.microsoft.sqlserver.jdbc.SQLSer
> verDriver\"\n jdbc_connection_string => \"jdbc:sqlserver://192.168.2.107:1433
> ;databaseName=Sourcing;integratedSecurity=false;user=team;password=team;\"\n
> jdbc_user => \"team\"\n jdbc_password => \"team\"\n statement => \"SELECT
> * FROM [Sourcing].[direct_feed].[WE_ExtractedRawData] \"\n }\n}\noutput {\n el
> asticsearch {\n host => \"localhost\"\n index => \"RawData\"\n document
> _type => \"DirectFeed\"\n document_id => \"%{ID}\"\n protocol => \"http\"\
> n }\n stdout { codec => rubydebug }\n}\n", :reason=>"Something is wrong with y
> our configuration."}
```

---

<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:** [January 10, 2017, 8:08am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/4 "2017-01-10T08:08:42Z")

</div>

The `host` and `protocol` options are for Logstash 1.x only. You should use `hosts` instead. See the documentation of the elasticsearch output for available options and what they mean.

---

<div class="post-metadata">

**Author:** ![ElsayedAwd](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@ElsayedAwd](https://discuss.elastic.co/u/ElsayedAwd)\
**Post date:** [January 10, 2017, 8:13am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/5 "2017-01-10T08:13:20Z")

</div>

ok I have already made this and it worked fine .

---

<div class="post-metadata">

**Author:** ![ElsayedAwd](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@ElsayedAwd](https://discuss.elastic.co/u/ElsayedAwd)\
**Post date:** [January 10, 2017, 8:56am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/6 "2017-01-10T08:56:14Z")

</div>

**please @magnusbaeck** How to track the updates of sqlserver like insert ,update ,delete into Elastic search via above configurations

---

<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:** [January 10, 2017, 9:56am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/7 "2017-01-10T09:56:44Z")

</div>

The stdout output that you already have will tell you what Logstash is emitting. Note that it won't delete anything from Elasticsearch.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 10, 2017, 10:01am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/8 "2017-01-10T10:01:16Z")

</div>

In order to track updates, inserts and deletes you will need to design your query so that it retrieves the desired changes. In order to not continuously retrieve all records you may want to use the [sql\_last\_value](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#_state) and compare this to a field in your data in order to only get changes since the last run.

---

<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:** [February 7, 2017, 10:01am UTC](https://discuss.elastic.co/t/sqlserver-logstash-configration/71029/9 "2017-02-07T10:01:45Z")

</div>

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