# Logstash Configuration File Ordering Does Matter

**URL:** https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840
**Category:** Logstash
**Created:** [September 8, 2015, 1:32pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840 "2015-09-08T13:32:34Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Yarden\_Bar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yarden_bar/32/736_2.png) [@Yarden\_Bar](https://discuss.elastic.co/u/Yarden_Bar)
#### Post date: [September 8, 2015, 1:32pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/1 "2015-09-08T13:32:34Z")

</div>

Hi all,  
I'm running logstash with a couple of -f switches and for some unknown reason, the order of the files does matter:

```
input-filter-output:
~/util/logstash-1.5.4/bin/logstash -f ./conf.d/input-50-email-sending.conf -f ./conf.d/filter-50-email-sending.conf -f ./conf.d/output-50-receiver.conf
Logstash startup completed
Logstash shutdown completed
 
input-output-filter:
~/util/logstash-1.5.4/bin/logstash -f ./conf.d/input-50-email-sending.conf -f ./conf.d/output-50-receiver.conf -f ./conf.d/filter-50-email-sending.conf
Logstash startup completed
Logstash shutdown completed
 
filter-output-input:
~/util/logstash-1.5.4/bin/logstash -f ./conf.d/filter-50-email-sending.conf -f ./conf.d/output-50-receiver.conf -f ./conf.d/input-50-email-sending.conf
Logstash startup completed
#gave is some time to run...
^CSIGINT received. Shutting down the pipeline. {:level=>:warn}
Logstash shutdown completed

```

Can someone explain this behaviour ?

Thanks,  
Yarden

---

<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: [September 8, 2015, 2:17pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/2 "2015-09-08T14:17:28Z")

</div>

Huh. Very odd. I've seen a couple of other folks reporting the same symptom, i.e. that Logstash immediately terminates right away without anything interesting in the log. Do _you_ get anything useful if you crank up the log level with `--debug`?

---

<div class="post-metadata">

### Author: ![Yarden\_Bar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yarden_bar/32/736_2.png) [@Yarden\_Bar](https://discuss.elastic.co/u/Yarden_Bar)
#### Post date: [September 12, 2015, 7:09pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/3 "2015-09-12T19:09:37Z")

</div>

Hi Magnus,  
With --debug, I found the following:

input-filter-output:

```
Plugin not defined in namespace, checking for plugin file {:type=>"output", :name=>"http", :path=>"logstash/outputs/http", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}
Plugin not defined in namespace, checking for plugin file {:type=>"codec", :name=>"plain", :path=>"logstash/codecs/plain", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}

```

input-output-filter

```
Plugin not defined in namespace, checking for plugin file {:type=>"filter", :name=>"csv", :path=>"logstash/filters/csv", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}

```

filter-output-input: Logstash starts and stays up:

```
Plugin not defined in namespace, checking for plugin file {:type=>"input", :name=>"file", :path=>"logstash/inputs/file", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}
Plugin not defined in namespace, checking for plugin file {:type=>"codec", :name=>"plain", :path=>"logstash/codecs/plain", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}

```

I didn't expect seeing errors in the 3rd bullet (filter-output-input), but Logstash stays up.

If the full log is needed, I can pastebin it, but it will take me some time to sanitize it.

Thanks

---

<div class="post-metadata">

### Author: ![Yarden\_Bar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yarden_bar/32/736_2.png) [@Yarden\_Bar](https://discuss.elastic.co/u/Yarden_Bar)
#### Post date: [September 12, 2015, 8:24pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/4 "2015-09-12T20:24:36Z")

</div>

Another interesting thing is that if I start Logstash with "bin/logstash - /etc/logstash/conf.d" (passing a directory containing my configuration) its working.

What is different between specifying specific files in certain order and specifying a directory containing the configuration?

---

<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: [September 13, 2015, 2:53pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/5 "2015-09-13T14:53:29Z")

</div>

> What is different between specifying specific files in certain order and specifying a directory containing the configuration?

Logstash sorts the configuration files found in a directory by name before reading them. Given how you have named your files, perhaps they happen to end up in the order that happens to work?

---

<div class="post-metadata">

### Author: ![Yarden\_Bar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yarden_bar/32/736_2.png) [@Yarden\_Bar](https://discuss.elastic.co/u/Yarden_Bar)
#### Post date: [September 14, 2015, 6:10pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/6 "2015-09-14T18:10:29Z")

</div>

My config files are standardised as follows:  
filter-[ORDERING\_NUMBER]-[DESC].conf =\> filter-50-CDN.conf  
input-[ORDERING\_NUMBER]-[DESC].conf =\> input-50-sockets.conf  
output-[ORDERING\_NUMBER]-[DESC].conf =\> output-50-http.conf

But we don't know that for sure, and if so, we don't know order that files should be ordered in.

Should I open an issue on main Logstash?

---

<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: [September 14, 2015, 6:23pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/7 "2015-09-14T18:23:30Z")

</div>

Yes, please open an issue for this. Configuration file ordering shouldn't matter except for the internal order of filters.

---

<div class="post-metadata">

### Author: ![Yarden\_Bar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yarden_bar/32/736_2.png) [@Yarden\_Bar](https://discuss.elastic.co/u/Yarden_Bar)
#### Post date: [September 14, 2015, 9:56pm UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/8 "2015-09-14T21:56:51Z")

</div>

[Issue](https://github.com/elastic/logstash/issues/3920) opened.

Thank you,  
Yarden

---

<div class="post-metadata">

### Author: ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)
#### Post date: [October 21, 2015, 9:14am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/9 "2015-10-21T09:14:27Z")

</div>

Hi,

can you tell me the order of letters and numbers?

lets say I have these files.

001-conf.conf  
999-conf.conf  
aaa-conf.conf  
zzz-conf.conf

will this be run in the order above, or are letters used first and then numbers?

---

<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: [October 21, 2015, 9:43am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/10 "2015-10-21T09:43:18Z")

</div>

Standard ASCII ordering (for lack of a better term) is used, so numbers come first, then lowercase letters, then uppercase letters.

---

<div class="post-metadata">

### Author: ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)
#### Post date: [October 21, 2015, 9:57am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/11 "2015-10-21T09:57:08Z")

</div>

thanks for the fast response, that helps a lot

---

<div class="post-metadata">

### Author: ![Architha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/architha/32/92477_2.png) [@Architha](https://discuss.elastic.co/u/Architha)
#### Post date: [February 9, 2016, 9:25am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/12 "2016-02-09T09:25:11Z")

</div>

How can you do the same on Windows ? Because there is no `conf.d` folder to store config files.  
Thanks!

---

<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: [February 9, 2016, 9:35am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/13 "2016-02-09T09:35:22Z")

</div>

> How can you do the same on Windows ? Because there is no conf.d folder to store config files.

Just create one somewhere. Logstash will read all config files in any directory it's configured to use with `-f`.

---

<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 6, 2017, 5:12am UTC](https://discuss.elastic.co/t/logstash-configuration-file-ordering-does-matter/28840/14 "2017-07-06T05:12:34Z")

</div>


