# How logstash forwarder works?

**URL:** <https://discuss.elastic.co/t/how-logstash-forwarder-works/33062>\
**Category:** Logstash\
**Created:** [October 27, 2015, 10:57am UTC](https://discuss.elastic.co/t/how-logstash-forwarder-works/33062 "2015-10-27T10:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sampasei](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sampasei](https://discuss.elastic.co/u/sampasei)\
**Post date:** [October 27, 2015, 10:57am UTC](https://discuss.elastic.co/t/how-logstash-forwarder-works/33062/1 "2015-10-27T10:57:10Z")

</div>

Hi all,  
i have a question about logstash-forwarder.  
I'm using a log program able to write txt files that are zipped and created again every hour: consider this case

8:59 my program is writing a file log.txt  
9.00 log.txt is zipped and archived, a new log.txt is created

Logstash-forwarder hasn't a buffer: its buffer is the log file. Consider this case:

8:50 logstash on the server side is down, logstash-forwarder tries to reconnect without any result  
9:00 logstash on the server side is still down, a new log file is created  
9:10 logstash is up, logstash-forwarder sends records to the server

I thought that the first record sent to the server was the first record of the file created at 9:00, but i see that previous records are sent to the logstash server....why?  
Thanks

---

<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:** [October 27, 2015, 6:58pm UTC](https://discuss.elastic.co/t/how-logstash-forwarder-works/33062/2 "2015-10-27T18:58:08Z")

</div>

I haven't studied the LSF source code in detail, but I'd assume this is because LSF kept the original file open all the time. Recall that in Unix-like systems it's normally fine to delete a file that a process has open without affecting the operation of that process. Once that process closes the file it'll be deleted from disk.

---

<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:25am UTC](https://discuss.elastic.co/t/how-logstash-forwarder-works/33062/3 "2017-07-06T05:25:11Z")

</div>


