# Logstash synchronization with postgresql

**URL:** <https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192>\
**Category:** Logstash\
**Created:** [June 25, 2018, 6:54am UTC](https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192 "2018-06-25T06:54:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iremsu](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@Iremsu](https://discuss.elastic.co/u/Iremsu)\
**Post date:** [June 25, 2018, 6:54am UTC](https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192/1 "2018-06-25T06:54:23Z")

</div>

Hi all,  
I am new on elk stack. I am using postgresql and the thing that i am trying to do it: i have a table called testtable with two columns key and value; whenever i add something in to these columns in my database i want it to be seen from logstash, i have a .conf file and inside of it i put a line:  
statement =\> "select \* from testtable"  
It is working to pick the table but when i just want to insert just one value it will always take again and again all the database table. So is there a way for logstash to take just once the all table and then whenever i insert just the inserted ones?  
Thank you

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 25, 2018, 7:33am UTC](https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192/2 "2018-06-25T07:33:41Z")

</div>

Have a look at [https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#\_predefined\_parameters](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#_predefined_parameters)

And use `sql_last_value`.

---

<div class="post-metadata">

**Author:** ![Iremsu](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@Iremsu](https://discuss.elastic.co/u/Iremsu)\
**Post date:** [June 27, 2018, 7:43am UTC](https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192/3 "2018-06-27T07:43:07Z")

</div>

Hello,i used sql last value but it takes the value as integer,not a day even though i used the tracking column as a date column, how can i fix this?

---

<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 25, 2018, 7:57am UTC](https://discuss.elastic.co/t/logstash-synchronization-with-postgresql/137192/4 "2018-07-25T07:57:21Z")

</div>

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