# Default values for value interpolation in autodiscovery

**URL:** <https://discuss.elastic.co/t/default-values-for-value-interpolation-in-autodiscovery/286950>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 18, 2021, 5:27am UTC](https://discuss.elastic.co/t/default-values-for-value-interpolation-in-autodiscovery/286950 "2021-10-18T05:27:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwvandesteeg](https://avatars.discourse-cdn.com/v4/letter/g/839c29/32.png) [@gwvandesteeg](https://discuss.elastic.co/u/gwvandesteeg)\
**Post date:** [October 18, 2021, 5:27am UTC](https://discuss.elastic.co/t/default-values-for-value-interpolation-in-autodiscovery/286950/1 "2021-10-18T05:27:15Z")

</div>

Is there a way to specify a default value for a value interpolation in the metricbeat configuration.

For example:

```auto
    modules.autodiscover:
      providers:
          # prometheus resource auto discovery
          - type: kubernetes
            cleanup_timeout: 0
            include_annotations:
              - "prometheus.io.scrape"
              - "prometheus.io.port"
              - "prometheus.io.path"
              - "prometheus.io/scrape_interval"
            templates:
              - condition:
                  equals:
                    kubernetes.annotations.prometheus.io.scrape: "true"
                config:
                  - module: prometheus
                    period: 10s
                    # period: ${data.kubernetes.annotations.prometheus.io/scrape_interval}
                    metricsets: ["collector"]
                    hosts: ["${data.host}:${data.kubernetes.annotations.prometheus.io/port}"]
                    metrics_path: "${data.kubernetes.annotations.prometheus.io/path}"
                    processors:
                      - add_tags:
                          tags: ["autodiscover", "prometheus"]

```

If we look at the value for the `period` we'd like to be able to use the value provide IF it exists, and default to 10 seconds if it did not exist and similary for the `metrics_path` value.  
I'd also be happy if this could be done using the conditions and implement a permutation of configurations to deal with the various cases that it could be.

ie. `metrics_path: "{{ default '/metrics' data.kubernetes.annotations.prometheus.io/path }}"` if using something like a golang template string.

---

<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 15, 2021, 7:27am UTC](https://discuss.elastic.co/t/default-values-for-value-interpolation-in-autodiscovery/286950/2 "2021-11-15T07:27:32Z")

</div>

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