# File output not ordered with -w 1

**URL:** <https://discuss.elastic.co/t/file-output-not-ordered-with-w-1/68699>\
**Category:** Logstash\
**Created:** [December 12, 2016, 10:51am UTC](https://discuss.elastic.co/t/file-output-not-ordered-with-w-1/68699 "2016-12-12T10:51:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![billy6](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@billy6](https://discuss.elastic.co/u/billy6)\
**Post date:** [December 12, 2016, 10:51am UTC](https://discuss.elastic.co/t/file-output-not-ordered-with-w-1/68699/1 "2016-12-12T10:51:41Z")

</div>

Hello, I have a logstash configuration

```
input{
elasticsearch {
        hosts=> ["SERVERHOST"]
        index => "logstash-syslog-2016.12.01"
         query => '{"filter" : {
                    "term" : { "host.raw" : "HOST" }

        }}'
    }

}

output {
   file{
         path => "/etc/elk/logout/FILE.log"
        }

}

```

The problem I have is with the file output, it is not ordered, I decreased the amount of workers to 1, but even with this the data appears not ordered in the file. (in ES is ordered)

---

<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:** [December 13, 2016, 3:51am UTC](https://discuss.elastic.co/t/file-output-not-ordered-with-w-1/68699/2 "2016-12-13T03:51:04Z")

</div>

You need to add a sort section to the query - [https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-request-sort.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-request-sort.html)

---

<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:** [January 10, 2017, 3:51am UTC](https://discuss.elastic.co/t/file-output-not-ordered-with-w-1/68699/3 "2017-01-10T03:51:28Z")

</div>

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