# Http\_poller: how to use an environment variable for the url?

**URL:** <https://discuss.elastic.co/t/http-poller-how-to-use-an-environment-variable-for-the-url/217935>\
**Category:** Logstash\
**Created:** [February 5, 2020, 9:20am UTC](https://discuss.elastic.co/t/http-poller-how-to-use-an-environment-variable-for-the-url/217935 "2020-02-05T09:20:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel99\_7](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Michel99\_7](https://discuss.elastic.co/u/Michel99_7)\
**Post date:** [February 5, 2020, 9:20am UTC](https://discuss.elastic.co/t/http-poller-how-to-use-an-environment-variable-for-the-url/217935/1 "2020-02-05T09:20:37Z")

</div>

I'm trying to use an env variable to define the url when using the http\_poller input plugin.  
But I have an error about the url encoding which is not good.

How to encode it?

```
http_poller {
	urls => {
		test => {
			url => "${LS_TEST_URL}"
			method => get
			headers => {Accept => "application/json"}
		}
	...
}
```

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [February 5, 2020, 9:48am UTC](https://discuss.elastic.co/t/http-poller-how-to-use-an-environment-variable-for-the-url/217935/2 "2020-02-05T09:48:11Z")

</div>

Hi @Michel99_7 .

1. I assume that you correctly set the environment variable? (e.g. `export LS_TEST_URL="myurl"`)?

2. Could you run Logstash with debug logging and send the debug logs to us?

For example: `bin/logtash --debug -f <PATH_TO_CONFIG_FILE>`

Thank you.

---

<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:** [March 4, 2020, 9:48am UTC](https://discuss.elastic.co/t/http-poller-how-to-use-an-environment-variable-for-the-url/217935/3 "2020-03-04T09:48:22Z")

</div>

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