# Is it possible to define the shared properties between different filebeat inputs just once?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [October 23, 2019, 4:50am UTC](https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758 "2019-10-23T04:50:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeaUser](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@SeaUser](https://discuss.elastic.co/u/SeaUser)\
**Post date:** [October 23, 2019, 4:50am UTC](https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758/1 "2019-10-23T04:50:57Z")

</div>

I have a filebeat.yml file, in which I want to define multiple filebeat inputs. I understand each input needs to be configured separately, but that would be sub-optimal in my opinion, since I could re-use a lot of properties that are shared across multiple inputs.

As an example, looking at this link, they have 2 inputs: [https://www.elastic.co/guide/en/beats/filebeat/master/configuration-filebeat-options.html](https://www.elastic.co/guide/en/beats/filebeat/master/configuration-filebeat-options.html)

My use case is, I need to define the multiline pattern settings, which happen to be the exact same between all my filebeat inputs. Ideally I do not want to repeat the same thing over and over again.

Looking at documentation, I couldn't find my answer, but hopefully I am wrong. It would be a lot of config duplication if this is not supported.

---

<div class="post-metadata">

**Author:** ![pmercado](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@pmercado](https://discuss.elastic.co/u/pmercado)\
**Post date:** [October 23, 2019, 7:25am UTC](https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758/2 "2019-10-23T07:25:40Z")

</div>

I don't know how standard yaml is the beats config parser, but I would expect yaml anchors to work.

Can you try them?

---

<div class="post-metadata">

**Author:** ![SeaUser](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@SeaUser](https://discuss.elastic.co/u/SeaUser)\
**Post date:** [October 24, 2019, 7:08pm UTC](https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758/3 "2019-10-24T19:08:37Z")

</div>

Yup, thank you very much for the help. YAML anchors worked perfectly and picked up by beats config parser. Can even do nesting.

Example:

```
default_filebeat_yml_config: &default_filebeat_configs
  filebeat.config.modules:
    path: "${path.config}/modules.d/*.yml"

default_filebeat_input_configs: &default_input_configs
  multiline.pattern: "<MY-PATTERN>"
  multiline.negate: false

```

And finally use them:

```
  filebeat.yml:
    filebeat.inputs:
    - type: log
      fields:
        application: <my-app>
      paths:
      - "<MY-LOGS>"
      <<: *default_input_configs
    <<: *default_filebeat_configs
```

---

<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:** [November 21, 2019, 7:08pm UTC](https://discuss.elastic.co/t/is-it-possible-to-define-the-shared-properties-between-different-filebeat-inputs-just-once/204758/4 "2019-11-21T19:08:47Z")

</div>

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