# Stitching multiple logstash inputs

**URL:** https://discuss.elastic.co/t/stitching-multiple-logstash-inputs/152880
**Category:** Logstash
**Created:** [October 17, 2018, 4:57pm UTC](https://discuss.elastic.co/t/stitching-multiple-logstash-inputs/152880 "2018-10-17T16:57:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Anirban\_mandal](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Anirban\_mandal](https://discuss.elastic.co/u/Anirban_mandal)
#### Post date: [October 17, 2018, 4:57pm UTC](https://discuss.elastic.co/t/stitching-multiple-logstash-inputs/152880/1 "2018-10-17T16:57:00Z")

</div>

I have a situation where my first http\_poller logstash is getting a session id as output. Now in the second http\_poller call i need to carry that session id in the request header.  
I am thinking of separating the two calls in two separate logstash processes. The first logstash will create the session and its output will be the session id over tcp/udp.  
The second logstash after reciving the event - need to execute another http\_poller call to get the actual data. Now the challange is  
- IN the second logstash instance how do i read the output over tcp and then pass it as header in the http\_poller call ?

Under these scenarios is there any thing else which you guys suggest ?

---

<div class="post-metadata">

### Author: ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)
#### Post date: [October 18, 2018, 10:28am UTC](https://discuss.elastic.co/t/stitching-multiple-logstash-inputs/152880/2 "2018-10-18T10:28:45Z")

</div>

As far as I know the http poller is not able to use a dynamic input to form its request like you'd want it to do. (I'd love to be wrong. So please correct me, if I am!)

You could probably use a Ruby filter for this (not tested):

```
ruby {
  init => "
    require 'net/http'
    require 'json'
  "
  code => "		  
    uri = URI.parse('http://blablabla?session_id=' + event.get('[session_id]'))
    response = Net::HTTP.get_response(uri)
    if response.code == '200'
      result = JSON.parse(response.body)
      event.set('[data]', result)
    end
  "
}
```

---

<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: [November 15, 2018, 10:39am UTC](https://discuss.elastic.co/t/stitching-multiple-logstash-inputs/152880/3 "2018-11-15T10:39:38Z")

</div>

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