# Log stash configuration file to push delta of data from SQL Server using JDBC Importer

**URL:** <https://discuss.elastic.co/t/log-stash-configuration-file-to-push-delta-of-data-from-sql-server-using-jdbc-importer/45841>\
**Category:** Logstash\
**Created:** [March 30, 2016, 7:02pm UTC](https://discuss.elastic.co/t/log-stash-configuration-file-to-push-delta-of-data-from-sql-server-using-jdbc-importer/45841 "2016-03-30T19:02:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreeramg](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sreeramg](https://discuss.elastic.co/u/sreeramg)\
**Post date:** [March 30, 2016, 7:02pm UTC](https://discuss.elastic.co/t/log-stash-configuration-file-to-push-delta-of-data-from-sql-server-using-jdbc-importer/45841/1 "2016-03-30T19:02:55Z")

</div>

Hi,

Any one has done this delta import in Logstatsh from sql server. my configuration file looks like this, but it fetches all the rows every time it is running. I need only the DELTA of data ( what changed/added/deleted) only to my ES.  
Suggestions are appreciated.

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:sqlserver://XXXXX:1433;databaseName=XXX"  
jdbc\_user =\> "XXX"  
jdbc\_password =\> "XXXX"  
jdbc\_validate\_connection =\> true  
jdbc\_driver\_library =\> "sqljdbc42.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
statement =\> "SELECT \* from XXXXXXXXXX"

}  
}  
output {  
elasticsearch  
{  
hosts =\> "localhost:9200"  
index =\> "test"  
}  
stdout { }  
}

---

<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:** [March 30, 2016, 7:54pm UTC](https://discuss.elastic.co/t/log-stash-configuration-file-to-push-delta-of-data-from-sql-server-using-jdbc-importer/45841/2 "2016-03-30T19:54:31Z")

</div>

Logstash won't magically know what's new and what's old. You have to change the query to only select the lines that haven't been processed. See [https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#\_state](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#_state) and how the `sql_last_value` parameter is used in the example.

---

<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:** [July 6, 2017, 5:04am UTC](https://discuss.elastic.co/t/log-stash-configuration-file-to-push-delta-of-data-from-sql-server-using-jdbc-importer/45841/3 "2017-07-06T05:04:42Z")

</div>


