Stitching multiple logstash inputs

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 ?

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
  "
}

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