# Logstash file input read order

**URL:** https://discuss.elastic.co/t/logstash-file-input-read-order/90246
**Category:** Logstash
**Created:** [June 21, 2017, 9:12am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246 "2017-06-21T09:12:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![giannisapi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giannisapi/32/19360_2.png) [@giannisapi](https://discuss.elastic.co/u/giannisapi)
#### Post date: [June 21, 2017, 9:12am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/1 "2017-06-21T09:12:18Z")

</div>

Hi to All,

I have one configuration file with multiple file inputs. Since deploy we have parsed hundreds of files, I now want to re parse everything but I want to re parse them ordered by creation time.

Could you tell me if and how this can be accomplished?

Kind Regards,  
Ioannis Ntantis

---

<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: [June 21, 2017, 9:46am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/2 "2017-06-21T09:46:58Z")

</div>

There's nothing built into Logstash for this. My best suggestion would be to rename the files according to the creation time and add them, in order, to a single file input's `path` parameter. Note that you don't have to touch the original files since you can use links (either soft or hard).

---

<div class="post-metadata">

### Author: ![Nico-DF](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nico-DF](https://discuss.elastic.co/u/Nico-DF)
#### Post date: [June 30, 2017, 11:48am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/3 "2017-06-30T11:48:16Z")

</div>

So if I get it right, when file plugin point to a dir (containing subdir), logstash reads them (assume -w 1) by alphabetical order?

So:

```auto
+dir
|_+c
| |_ab
| |_aa
|_+a
  |_z

```

is read: dir/a/z then dir/c/aa then dir/c/ab by logstash?

---

<div class="post-metadata">

### Author: ![Nico-DF](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nico-DF](https://discuss.elastic.co/u/Nico-DF)
#### Post date: [June 30, 2017, 12:16pm UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/4 "2017-06-30T12:16:04Z")

</div>

Ok, in fact, read order is the same than ls -U. Any idea how I can somehow make the directory entry the same as the alphabetical order?

---

<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: [June 30, 2017, 1:04pm UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/5 "2017-06-30T13:04:07Z")

</div>

The directory traversal order is not configurable in Logstash. I can't think of a reasonable workaround except what I said earlier or having an external program that concatenates the files in the right order into a single file that Logstash is configured to read.

---

<div class="post-metadata">

### Author: ![Nico-DF](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nico-DF](https://discuss.elastic.co/u/Nico-DF)
#### Post date: [July 3, 2017, 7:43am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/6 "2017-07-03T07:43:20Z")

</div>

Ok, thanks. I'm currently trying a workaround using rsync to copy files from repo to entrypoint

---

<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 31, 2017, 7:43am UTC](https://discuss.elastic.co/t/logstash-file-input-read-order/90246/7 "2017-07-31T07:43:23Z")

</div>

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