Http_poller – Run once and terminate

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

2 Likes

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

What does the rest of your pipeline do?

For testing purposes literally nothing.

Test it yourself:

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

#output { stdout { } }

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

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?

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.

2 Likes

Okay, thank you.

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