# Include conf files

**URL:** https://discuss.elastic.co/t/include-conf-files/135480
**Category:** Logstash
**Created:** [June 12, 2018, 8:00am UTC](https://discuss.elastic.co/t/include-conf-files/135480 "2018-06-12T08:00:41Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)
#### Post date: [June 12, 2018, 8:00am UTC](https://discuss.elastic.co/t/include-conf-files/135480/1 "2018-06-12T08:00:41Z")

</div>

filter {  
.... # do stuff A  
}  
B.conf :

filter {  
.... # do stuff B  
}

Can this be achieved somehow?

run.conf :

input { ... }

include('B')  
include('C')

output { ... }

---

<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 12, 2018, 8:05am UTC](https://discuss.elastic.co/t/include-conf-files/135480/2 "2018-06-12T08:05:35Z")

</div>

No, Logstash has no inclusion functionality. If you explain the situation in greater detail we might be able to give another suggestion.

---

<div class="post-metadata">

### Author: ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)
#### Post date: [June 12, 2018, 8:12am UTC](https://discuss.elastic.co/t/include-conf-files/135480/3 "2018-06-12T08:12:12Z")

</div>

I'll try. Currently I have one configuration file which deals with multiple clients.

I want to separate the script, so now each client will have it's own script. But you see there are few functionalities which are common between the clients. Considering the filter part will exactly be the same for those functionalities there must be an approach for reuse-ability. So I can include the part which is the same in the scripts rather than writing the same script again and again; copy pasta.

Considering the client will grow I need to have an approach in which I re use my already written script.

---

<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 12, 2018, 9:48am UTC](https://discuss.elastic.co/t/include-conf-files/135480/4 "2018-06-12T09:48:52Z")

</div>

And you have separate instances or pipelines for different clients? Use symlinks to have the same file appear in multiple directories.

---

<div class="post-metadata">

### Author: ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)
#### Post date: [June 20, 2018, 5:36am UTC](https://discuss.elastic.co/t/include-conf-files/135480/5 "2018-06-20T05:36:19Z")

</div>

Yes, separate instances for each client. Is there any other alternative?

---

<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 20, 2018, 6:13am UTC](https://discuss.elastic.co/t/include-conf-files/135480/6 "2018-06-20T06:13:55Z")

</div>

Other alternatives to having one instance per client? You can have a single instance with multiple pipelines.

---

<div class="post-metadata">

### Author: ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)
#### Post date: [June 20, 2018, 7:00am UTC](https://discuss.elastic.co/t/include-conf-files/135480/7 "2018-06-20T07:00:50Z")

</div>

Well I was taking about reusing the similar part of conf file which is common across the clients by using include or some other approach.

---

<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 20, 2018, 7:07am UTC](https://discuss.elastic.co/t/include-conf-files/135480/8 "2018-06-20T07:07:28Z")

</div>

As I said there is no inclusion functionality. The only other option I can think of is generating compound configuration files based on multiple source files.

---

<div class="post-metadata">

### Author: ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)
#### Post date: [June 20, 2018, 7:09am UTC](https://discuss.elastic.co/t/include-conf-files/135480/9 "2018-06-20T07:09:27Z")

</div>

> [@magnusbaeck](#):
>
> generating compound configuration files based on multiple source files.

Can you provide an example of this, Thank you.

---

<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 20, 2018, 7:18am UTC](https://discuss.elastic.co/t/include-conf-files/135480/10 "2018-06-20T07:18:06Z")

</div>

You store the configuration files in whatever form you want, then use a script to concatenate the files according to some set of rules. That way you can feed Logstash a single configuration file (or multiple, that's up to how the script is written) while still maintaining the pieces separately and without duplication.

---

<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 18, 2018, 7:27am UTC](https://discuss.elastic.co/t/include-conf-files/135480/11 "2018-07-18T07:27:19Z")

</div>

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