# Order of file generation and file reading

**URL:** <https://discuss.elastic.co/t/order-of-file-generation-and-file-reading/38914>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 11, 2016, 8:12pm UTC](https://discuss.elastic.co/t/order-of-file-generation-and-file-reading/38914 "2016-01-11T20:12:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)\
**Post date:** [January 11, 2016, 8:12pm UTC](https://discuss.elastic.co/t/order-of-file-generation-and-file-reading/38914/1 "2016-01-11T20:12:11Z")

</div>

I used filebeat logstash and elasticsearch together to port data from files to elasticsearch, I have a process to generate files in a folder, and filebeat reads them and sends data to logstash then to elasticsearch. The flow goes like this:  
files (step 1) -\> filebeat(step 2) -\> logstash (step 3)- elasticsearch

It seems to me the order is very important, I need to start the application to generate files(step 1) first, and then start filebeat (step 2)

If I do it in an opposite order, start filebeat process first, and then start generating files , filebeat cannot read files. I used -e -d "\*" to track the response when initiating the filebeat, the process responds like "filebeat is harvisting on the file". But it will never start reading the file.

So shall I assume that I have to start generating the files before starting filebeat to read the files?

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [January 11, 2016, 9:07pm UTC](https://discuss.elastic.co/t/order-of-file-generation-and-file-reading/38914/2 "2016-01-11T21:07:01Z")

</div>

Hi,

Using a path like `/path/to/files/*` the prospector will scan the directory for new files every 10 seconds. So you shouldn't need to generate the files before starting Filebeat. You can also decrease the scan\_frequency if you want Filebeat to check for new files quicker:

[https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-configuration-details.html#\_scan\_frequency](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-configuration-details.html#_scan_frequency)

---

<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 5, 2017, 9:56pm UTC](https://discuss.elastic.co/t/order-of-file-generation-and-file-reading/38914/3 "2017-07-05T21:56:51Z")

</div>


