# Using variables/constants in input

**URL:** <https://discuss.elastic.co/t/using-variables-constants-in-input/305402>\
**Category:** Logstash\
**Created:** [May 23, 2022, 12:54pm UTC](https://discuss.elastic.co/t/using-variables-constants-in-input/305402 "2022-05-23T12:54:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![msl09](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/msl09/32/106035_2.png) [@msl09](https://discuss.elastic.co/u/msl09)\
**Post date:** [May 23, 2022, 12:54pm UTC](https://discuss.elastic.co/t/using-variables-constants-in-input/305402/1 "2022-05-23T12:54:10Z")

</div>

Consider the following code:

```auto
input {
  http_poller {
    urls => {
      myurl1 => {
        ...
        password => 123456
      }
      myurl2 => {
        ...
        password => 123456
      }
      ...
    }
    ...
  }
  ...
}

```

Can I replace `password => 123456` with something like `password => ${mypassword}` without using environment variables?

Although environment variables could solve the problem, I have many _"constants"_ in my code that are nearly/exactly identical in my pipeline and I think it would be unwidely to pass them as env vars on every execution.

I'm considering generating my pipeline programatically from a template. Is that the most common approact to this kind of problem?

---

<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:** [June 20, 2022, 12:54pm UTC](https://discuss.elastic.co/t/using-variables-constants-in-input/305402/2 "2022-06-20T12:54:57Z")

</div>

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