# How to pass variable base parameter in http\_poller logstash input plugin

**URL:** https://discuss.elastic.co/t/how-to-pass-variable-base-parameter-in-http-poller-logstash-input-plugin/298621
**Category:** Logstash
**Created:** [March 2, 2022, 1:33pm UTC](https://discuss.elastic.co/t/how-to-pass-variable-base-parameter-in-http-poller-logstash-input-plugin/298621 "2022-03-02T13:33:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [March 2, 2022, 8:16pm UTC](https://discuss.elastic.co/t/how-to-pass-variable-base-parameter-in-http-poller-logstash-input-plugin/298621/2 "2022-03-02T20:16:41Z")

</div>

You cannot do that using an http\_poller input. You will have to use http filters. You can drive the schedule using a heartbeat input

```
heartbeat { interval => 60 }

```

If you can do a login for every audit\_trail request then just use two http filters. If you need to use a single session for everything then you will need to use a single worker thread, and I think you will need to set pipeline.ordered to be true. Maybe something like

```
ruby {
    code => '
        if ! @@sessionId
            event.set("[@metadata][needId]", true)
        end
    '
}

if ! [@metadata][needId] {
    ruby { code => 'event.set([@metadata][id]", @@sessionId)' }
else
    http {
        # Make the call to api/v1/login
    }
    # Parse the session id from the response into [@metadata][id]
    ruby { code => '@@sessionId = event.get("[@metadata][id]")' }
end
http {
    # Make the call to audit_trail
}

```

Note the use of a variable with class scope (@@) so that multiple ruby filters can share it. `[@metadata]` is a field on the event that is ignored by most outputs, so it is useful for temporary variables.

If sessions expire then you will need to add code that sets `@@sessionId` back to nil just before that happens.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-pass-variable-base-parameter-in-http-poller-logstash-input-plugin/298621)._
