# Is output order guaranteed?

**URL:** https://discuss.elastic.co/t/is-output-order-guaranteed/175639
**Category:** Logstash
**Created:** [April 5, 2019, 5:55pm UTC](https://discuss.elastic.co/t/is-output-order-guaranteed/175639 "2019-04-05T17:55:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![smbullet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smbullet/32/27833_2.png) [@smbullet](https://discuss.elastic.co/u/smbullet)
#### Post date: [April 5, 2019, 5:55pm UTC](https://discuss.elastic.co/t/is-output-order-guaranteed/175639/1 "2019-04-05T17:55:25Z")

</div>

If I have several outputs defined, are my events guaranteed to hit each output in the order they are defined?

I want to have an output plugin add a tag if it fails and have a conditional that will send my event to a file if that tag exists. It would look like this:

```
output {
    my_custom_output_plugin {}

    if "failed_custom_output" in [tags] {
        file {
            path => "/var/log/failed_to_send.log"
        }
    }
}

```

The logic to add the tag would exist in the custom output plugin. Would something like this work?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 5, 2019, 6:15pm UTC](https://discuss.elastic.co/t/is-output-order-guaranteed/175639/2 "2019-04-05T18:15:18Z")

</div>

> [@smbullet](#):
>
> If I have several outputs defined, are my events guaranteed to hit each output in the order they are defined?

I am not certain, but I believe ordering is effectively random. The outputs run independently.

---

<div class="post-metadata">

### Author: ![smbullet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smbullet/32/27833_2.png) [@smbullet](https://discuss.elastic.co/u/smbullet)
#### Post date: [April 5, 2019, 6:22pm UTC](https://discuss.elastic.co/t/is-output-order-guaranteed/175639/3 "2019-04-05T18:22:32Z")

</div>

It's my understanding that the outputs are shared resources that the pipeline workers need to grab a lock for. It would make sense that instead of blocking on one output it would work on others first but I can't find anything that documents this behavior.

---

<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: [May 3, 2019, 6:22pm UTC](https://discuss.elastic.co/t/is-output-order-guaranteed/175639/4 "2019-05-03T18:22:40Z")

</div>

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