# Http\_poller – Run once and terminate

**URL:** <https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195>\
**Category:** Logstash\
**Created:** [January 7, 2019, 12:01pm UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195 "2019-01-07T12:01:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![darefilz](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@darefilz](https://discuss.elastic.co/u/darefilz)\
**Post date:** [January 7, 2019, 12:01pm UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/1 "2019-01-07T12:01:59Z")

</div>

Hi,

I want to use the Http\_poller input plugin to call a REST API only once. The actual scheduling is done outside of Logstash (Docker).  
To make this happen, I set the `schedule` attribute to `{ "in" => "0" }`, which indeed triggers the request once and immediately. Unfortunately the Http\_poller plugin does not terminate, so Logstash does not terminate, so the Docker container does not terminate, which is bad in my situation.  
Am I doing something wrong? Can you help me out?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 7, 2019, 9:27pm UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/2 "2019-01-07T21:27:22Z")

</div>

> [@darefilz](#):
>
> Am I doing something wrong?

Nope, Logstash assumes it has something else it needs to run and so persists.

What does the rest of your pipeline do?

---

<div class="post-metadata">

**Author:** ![darefilz](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@darefilz](https://discuss.elastic.co/u/darefilz)\
**Post date:** [January 8, 2019, 9:49am UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/3 "2019-01-08T09:49:12Z")

</div>

> [@warkolm](#):
>
> What does the rest of your pipeline do?

For testing purposes literally nothing.

Test it yourself:

```auto
input {
  http_poller {
    urls => {
      google => {
        url => "http://google.de"
      }
    }
    codec => "plain"
    schedule => { "in" => "0" }
  }
}

#output { stdout { } }

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 8, 2019, 9:50am UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/4 "2019-01-08T09:50:41Z")

</div>

Well I ask cause you might just want to use curl and keep it simple.

---

<div class="post-metadata">

**Author:** ![darefilz](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@darefilz](https://discuss.elastic.co/u/darefilz)\
**Post date:** [January 8, 2019, 12:15pm UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/5 "2019-01-08T12:15:07Z")

</div>

Thanks for the hint, but parsing the output of _curl_ in a pain with `multiline` codec or the like.  
Any ideas why Http\_poller is not working the way we expect it?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 9, 2019, 5:46am UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/6 "2019-01-09T05:46:08Z")

</div>

It wasn't designed as a run once approach, the assumption is that you will want to continually connect to get the data. It might be worth raising a feature request to cater for this behaviour if you want it.

You may also want to look at the `exec` input and use curl to get it that way.

---

<div class="post-metadata">

**Author:** ![darefilz](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@darefilz](https://discuss.elastic.co/u/darefilz)\
**Post date:** [January 10, 2019, 8:04am UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/7 "2019-01-10T08:04:27Z")

</div>

Okay, 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:** [February 7, 2019, 8:04am UTC](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/8 "2019-02-07T08:04:43Z")

</div>

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