# Multiple logstash output configurations

**URL:** <https://discuss.elastic.co/t/multiple-logstash-output-configurations/236840>\
**Category:** Logstash\
**Created:** [June 12, 2020, 7:10am UTC](https://discuss.elastic.co/t/multiple-logstash-output-configurations/236840 "2020-06-12T07:10:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OatmealOgre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oatmealogre/32/45404_2.png) [@OatmealOgre](https://discuss.elastic.co/u/OatmealOgre)\
**Post date:** [June 12, 2020, 7:10am UTC](https://discuss.elastic.co/t/multiple-logstash-output-configurations/236840/1 "2020-06-12T07:10:54Z")

</div>

I've been trying to find information on this and started to wonder if it's even possible.  
Situation is as follows.  
We have several logstash pipeline configuration files. All of them have their output largely the same, just some smaller differences.

Is there a way where we could use two configuration files for the same output to elasticsearch?  
The shared part would contain the following:

```auto
   output {
      elasticsearch {
   		hosts => ["localhost:9200"]
   		user => "logstash_writer"
   		password => ...
   		ssl => true
   		cacert => "/path/elasticsearch-ca.pem"
      }
   }

```

but then we have fields that differ from pipeline to pipeline such as `index`, `document_id`, `ilm_pattern`, etc

Is there a way to load in a separate file for just those extra lines inside the output/elasticsearch section? Or load in this file in those configuration files?

---

<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:** [June 12, 2020, 2:46pm UTC](https://discuss.elastic.co/t/multiple-logstash-output-configurations/236840/2 "2020-06-12T14:46:33Z")

</div>

You could try doing this using [sprintf references](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf) to metadata fields set earlier in the pipeline.

---

<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 10, 2020, 2:46pm UTC](https://discuss.elastic.co/t/multiple-logstash-output-configurations/236840/3 "2020-07-10T14:46:52Z")

</div>

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