# Merging Configuration Files

**URL:** <https://discuss.elastic.co/t/merging-configuration-files/39990>\
**Category:** Beats\
**Created:** [January 25, 2016, 4:18am UTC](https://discuss.elastic.co/t/merging-configuration-files/39990 "2016-01-25T04:18:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcfens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pcfens/32/7316_2.png) [@pcfens](https://discuss.elastic.co/u/pcfens)\
**Post date:** [January 25, 2016, 4:18am UTC](https://discuss.elastic.co/t/merging-configuration-files/39990/1 "2016-01-25T04:18:49Z")

</div>

Is it possible to merge various configuration files and fields (like the input/procs field)?

I'd like to distribute a default configuration file to all of my machines with output information, and add additional files for the various processes that should be tracked. Something like how configuration directories are handled in filebeat, but where it makes sense.

Thanks!

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 25, 2016, 10:23am UTC](https://discuss.elastic.co/t/merging-configuration-files/39990/2 "2016-01-25T10:23:45Z")

</div>

This is currently not supported.

On master we've added support for env variables, though: [https://github.com/elastic/beats/pull/715](https://github.com/elastic/beats/pull/715)

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 25, 2016, 10:25am UTC](https://discuss.elastic.co/t/merging-configuration-files/39990/3 "2016-01-25T10:25:27Z")

</div>

Out of curiosity: What would these config files look like? e.g. input/procs is a list of values. When merging configs it's pretty viable to overwrite the old list for example, but you seem to want an append like op, right?

---

<div class="post-metadata">

**Author:** ![pcfens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pcfens/32/7316_2.png) [@pcfens](https://discuss.elastic.co/u/pcfens)\
**Post date:** [January 25, 2016, 5:25pm UTC](https://discuss.elastic.co/t/merging-configuration-files/39990/4 "2016-01-25T17:25:24Z")

</div>

I'm thinking more of a deep merge than a replace, but duplicate keys would have to replace (perhaps the later ones taking precedent?).

Something like

a.yml

```auto
---
  input:
    period: 10
    procs:
      - "sshd"
    stats:
      system: true
      proc: true
      filesystem:true
  output:
    elasticsearch:
      hosts:
        - "es1.example.com"

```

merged with b.yaml

```auto
---
  input:
    period: 15
    procs:
      - "apache"

```

would result in

```auto
---
  input:
    period: 15
    procs:
      - "sshd"
      - "apache"
    stats:
      system: true
      proc: true
      filesystem:true
  output:
    elasticsearch:
      hosts:
        - "es1.example.com"

```

---

<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 5, 2017, 9:56pm UTC](https://discuss.elastic.co/t/merging-configuration-files/39990/5 "2017-07-05T21:56:24Z")

</div>


