Merging Configuration Files


(Pcfens) #1

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!


(Steffen Siering) #2

This is currently not supported.

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


(Steffen Siering) #3

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?


(Pcfens) #4

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

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

merged with b.yaml

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

would result in

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

(system) #5