# JDBC last run is updated, but logstash always start from the beggining and duplicate documents

**URL:** https://discuss.elastic.co/t/jdbc-last-run-is-updated-but-logstash-always-start-from-the-beggining-and-duplicate-documents/280091
**Category:** Logstash
**Created:** [July 30, 2021, 3:11pm UTC](https://discuss.elastic.co/t/jdbc-last-run-is-updated-but-logstash-always-start-from-the-beggining-and-duplicate-documents/280091 "2021-07-30T15:11:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)
#### Post date: [July 30, 2021, 3:11pm UTC](https://discuss.elastic.co/t/jdbc-last-run-is-updated-but-logstash-always-start-from-the-beggining-and-duplicate-documents/280091/1 "2021-07-30T15:11:53Z")

</div>

Hi, I have a pipeline with JDBC input with schedule of 5 min, I ran logstash as a service

```auto
sudo systemctl start logstash

```

and the JDBC last run is updated, but when logstash start the last run is not used an duplicate documents.

the permissions for the folder and the file are

```auto
logstash:logstash

```

also tried with

```auto
logstash:root 

```

but still is duplicating the documents. this is the input of my pipeline

```auto
jdbc {
                jdbc_driver_class => "org.postgresql.Driver"
                jdbc_connection_string => "jdbc:postgresql:..."
                jdbc_user => "..."
                jdbc_password => "..."
                jdbc_validate_connection => true
                statement => "...
                                order by history.clock asc"
                schedule => "*/5 * * * *"
                use_column_value => true
                record_last_run => true
                tracking_column => "clock"
                last_run_metadata_path => "/etc/logstash/conf.d/db/nselec-ups-lastrun-history.yml"
                type => "history"
                }

```

what is wrong with my configuration file?

---

<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: [August 27, 2021, 3:12pm UTC](https://discuss.elastic.co/t/jdbc-last-run-is-updated-but-logstash-always-start-from-the-beggining-and-duplicate-documents/280091/2 "2021-08-27T15:12:28Z")

</div>

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