# Fetch only new entries From mssql

**URL:** <https://discuss.elastic.co/t/fetch-only-new-entries-from-mssql/274195>\
**Category:** Logstash\
**Created:** [May 27, 2021, 11:27am UTC](https://discuss.elastic.co/t/fetch-only-new-entries-from-mssql/274195 "2021-05-27T11:27:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akash01](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@akash01](https://discuss.elastic.co/u/akash01)\
**Post date:** [May 27, 2021, 11:27am UTC](https://discuss.elastic.co/t/fetch-only-new-entries-from-mssql/274195/1 "2021-05-27T11:27:08Z")

</div>

Hi,  
I am fetching data from mssql database table which is keep on updating So I want to fetch only the new entries from the table but each time It is fetching all the data.  
like if there are total 5 records then after 1 min records are increasing to 10 then 15 and so on . my script is as below.  
input {  
#demo  
jdbc {  
jdbc\_driver\_library =\> "/usr/share/logstash/logstash-core/lib/jars/mssql-jdbc-8.4.1.jre8.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://XXXXXXX:1433;databaseName=XXXXXXXX"  
jdbc\_user =\> "XXXXXX"  
jdbc\_password =\> "XXXXXX"  
schedule =\> "\* \* \* \* \*"  
use\_column\_value =\> true  
tracking\_column =\> date  
tracking\_column\_type =\> "timestamp"

statement=\>"select id,date,tripno from(select id,date(timestamp) as date,tripno from table group by id)a where date\>=:sql\_last\_value"

```
    type => "tabledata"

```

}

}  
output {  
elasticsearch {  
hosts =\> "[https://localhost:9200](https://localhost:9200)"  
user =\> "XXXX"  
password =\> "XXXXX"  
index =\> "%{type}"  
#action =\> "update"  
ssl =\> false  
ssl\_certificate\_verification =\>false  
# cacert =\>"/home/azureuser/cert/root-ca.pem"  
ilm\_enabled =\> false  
}  
#stdout { codec =\> rubydebug }  
}

please Tell me where I am doing it wrong .every min index size is getting increased. do i need to apply fingerprint or if can edit property here in the same script .Thanks In advance

---

<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:** [June 24, 2021, 11:27am UTC](https://discuss.elastic.co/t/fetch-only-new-entries-from-mssql/274195/2 "2021-06-24T11:27:10Z")

</div>

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