# Need help deciding which input plugin to use

**URL:** <https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360>\
**Category:** Logstash\
**Created:** [July 1, 2019, 3:34pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360 "2019-07-01T15:34:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![az123](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@az123](https://discuss.elastic.co/u/az123)\
**Post date:** [July 1, 2019, 3:34pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/1 "2019-07-01T15:34:18Z")

</div>

I want to use log stash to act as a tcp client to get some data from the server. I need logstash to send a json message over to the server to request the data of interest before the server can send that data over (More like tcp session with request response kind of transactions). Does logstash have this kind of capability? If so, can someone point me to a config file example that can help me achieve this?

---

<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:** [July 1, 2019, 3:57pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/2 "2019-07-01T15:57:14Z")

</div>

You could use an exec input that would run an external client to make the request, or you could use a generator input to create an event, and then use a ruby filter to make the TCP connection and send a request.

---

<div class="post-metadata">

**Author:** ![az123](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@az123](https://discuss.elastic.co/u/az123)\
**Post date:** [July 2, 2019, 1:39pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/3 "2019-07-02T13:39:56Z")

</div>

Thanks! Let me try that.

---

<div class="post-metadata">

**Author:** ![az123](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@az123](https://discuss.elastic.co/u/az123)\
**Post date:** [July 5, 2019, 6:16pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/4 "2019-07-05T18:16:22Z")

</div>

Hi,

Can you share some sample config file that I can use to achieve these options?

Thanks!

---

<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:** [July 5, 2019, 6:34pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/5 "2019-07-05T18:34:23Z")

</div>

No. To do that I would need knowledge of the API you are calling.

---

<div class="post-metadata">

**Author:** ![az123](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@az123](https://discuss.elastic.co/u/az123)\
**Post date:** [July 11, 2019, 4:47pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/6 "2019-07-11T16:47:21Z")

</div>

There is no API call here. Its a plain tcp connection request to a node on port 45670 and send a json string to that port. Thats it!

I tried both the options you mentioned like so:

#input {  
#generator {

# lines =\> ["{ "host": "x.x.x.x", "port": 45670, "cid": "xxx", "grpc": { "ws" : 524288 }, "paths": [{ "path":, "/interfaces", "freq", 2000 }] }"

# ]

# }

#}  
#Sending the json info to the juniper node  
filter {  
ruby {  
code =\> '  
require "socket" # Sockets are in standard library  
hostname = "x.x.x.x"  
port = 45670

s = TCPSocket.open(hostname, port)

#while line = s.gets # Read lines from the socket  
request = '{ "host": "x.x.x.x", "port": 45670, "cid": "elk1", "grpc": { "ws": 524288 }, "paths": [{ "path": "/interfaces", "freq": 2000 }] }'  
s.puts(request)  
# And print with platform line terminator  
#end  
#s.close # Close the socket when done  
"  
}  
}

---

<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:** [August 8, 2019, 4:56pm UTC](https://discuss.elastic.co/t/need-help-deciding-which-input-plugin-to-use/188360/7 "2019-08-08T16:56:49Z")

</div>

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