# Reading files chronologically

**URL:** https://discuss.elastic.co/t/reading-files-chronologically/79466
**Category:** Logstash
**Created:** [March 21, 2017, 4:18pm UTC](https://discuss.elastic.co/t/reading-files-chronologically/79466 "2017-03-21T16:18:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![blacklobo](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@blacklobo](https://discuss.elastic.co/u/blacklobo)
#### Post date: [March 21, 2017, 4:18pm UTC](https://discuss.elastic.co/t/reading-files-chronologically/79466/1 "2017-03-21T16:18:09Z")

</div>

Is there a way to force Logstash to open files in chronological order so that they are written to the Kafka topic in chronological order?

I am setting up a Logstash instance that will read files written to a server (2 new files per minute) and output them to Kafka. My environment captures the contents of Kafka every 30 minutes and stores them to HDFS. I have this setup and it works well when everything is up and processing files in realtime. However if Logstash or Kafka are down for any length of time, when Logstash starts sending data to Kafka again numerous files are written to the HDFS. I believe this is being caused by Logstash opening multiple files and sending the contents to Kafka not in chronological order.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [March 21, 2017, 8:33pm UTC](https://discuss.elastic.co/t/reading-files-chronologically/79466/2 "2017-03-21T20:33:10Z")

</div>

> [@blacklobo](#):
>
> Is there a way to force Logstash to open files in chronological order so that they are written to the Kafka topic in chronological order?

Nope.

---

<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: [April 18, 2017, 8:33pm UTC](https://discuss.elastic.co/t/reading-files-chronologically/79466/3 "2017-04-18T20:33:10Z")

</div>

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