# Logstash file read , mode read, sincedb, duplicate events after restart logstash

**URL:** <https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126>\
**Category:** Logstash\
**Created:** [November 30, 2020, 8:28pm UTC](https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126 "2020-11-30T20:28:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slast](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@slast](https://discuss.elastic.co/u/slast)\
**Post date:** [November 30, 2020, 8:28pm UTC](https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126/1 "2020-11-30T20:28:14Z")

</div>

Hi Guys  
Can you help me  
I have a problem with reading files from logstash.  
After restarting logstash, it rereads the files again and sends events to Elastic.

This folder is mounted from another server /opt/Logstore/TMP/\*.gz

./logstash --version  
Using bundled JDK: /usr/share/logstash/jdk  
logstash 7.10.0

Here is my config

``````````````````auto
input {

    file {
        
       path => ["/opt/Logstore/TMP/*.gz"]
        mode => "read"
        start_position => "beginning"
        discover_interval => 15
        close_older => "1 minute"
        file_completed_action => "log"
        file_completed_log_path => "/etc/logstash/conf.d/filereader/complete_log_k.db"
        sincedb_path => "/etc/logstash/conf.d/filereader/since_k.db"
        sincedb_clean_after => "180"
    }

}

output {

    tcp {
        host => "1.1.1.1"
        port => 3333
        codec => line {
            format => "%{message}"
        }
    }

}
`````````````````
``````````````````

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 30, 2020, 11:24pm UTC](https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126/2 "2020-11-30T23:24:39Z")

</div>

There used to be a bug where sincedb\_clean\_after was actually a number of seconds, not days as documented. However, that was fixed a while back.

I suggest you look at the contents of /etc/logstash/conf.d/filereader/since\_k.db and see if it contains the entries you expect after you shut logstash down.

Note that entries are not persisted to disk immediately. If you create /opt/Logstore/TMP/1.gz there will not be an entry on disk. If you then create /opt/Logstore/TMP/2.gz an entry will appear on disk for /opt/Logstore/TMP/1.gz etc. Do not worry about the sincedb on disk while logstash is running, just check it after logstash has stopped.

---

<div class="post-metadata">

**Author:** ![slast](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@slast](https://discuss.elastic.co/u/slast)\
**Post date:** [December 1, 2020, 10:15am UTC](https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126/3 "2020-12-01T10:15:12Z")

</div>

Hi Badger  
Thanks for you reply.  
I changed sincedb\_clean\_after =\> "180" to sincedb\_clean\_after =\> "180d"

Problem is that i can see in sincedb my duplicate files and then in Elasticsearch after restart logstash

But, if my folder is local, not shared, logstash is working fine.

I can copy files from shared folder to local, but i think this is not good idea 🙂

---

<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:** [December 29, 2020, 10:15am UTC](https://discuss.elastic.co/t/logstash-file-read-mode-read-sincedb-duplicate-events-after-restart-logstash/257126/4 "2020-12-29T10:15:32Z")

</div>

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