# Stuck with Ruby SocketError

**URL:** <https://discuss.elastic.co/t/stuck-with-ruby-socketerror/72490>\
**Category:** Logstash\
**Created:** [January 23, 2017, 2:18pm UTC](https://discuss.elastic.co/t/stuck-with-ruby-socketerror/72490 "2017-01-23T14:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melpheos](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@Melpheos](https://discuss.elastic.co/u/Melpheos)\
**Post date:** [January 23, 2017, 2:18pm UTC](https://discuss.elastic.co/t/stuck-with-ruby-socketerror/72490/1 "2017-01-23T14:18:56Z")

</div>

Hi,

we are getting sflow information with logstash and would like to use a simple ruby code to calculate the average bandwidth used by ip.  
Unfortunately when we activate in our filter rule the ruby code we end up with the following error on boot  
[2017-01-23T15:10:33,636][WARN][logstash.inputs.udp] UDP listener died {:exception=\>#\<SocketError: bind: name or service not known\>, :backtrace=\>["org/jruby/ext/socket/RubyUDPSocket.java:160:in `bind'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:82:in`udp\_listener'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:56:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:365:in`inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:359:in `start\_input'"]}

We are using a warper in the input  
input {  
pipe {  
type =\> "sflow"  
command =\> "/usr/local/bin/sflowtool\_wrapper.sh -l -p 6343"  
}  
}  
And i highly suspect this is the reason why ruby wont find the port.  
Is there a solution to fix this issue ?  
We have obviously tried without the warper but we end up with lot of garbage character instead of our flow as sflowtool does the job of decoding the frames.

I dont think the ruby code is the issue  
ruby {  
code =\> 'event.set("[sflow][in\_bytes]", event.get("[sflow][SampleRate]")\* event.get("[sflow][PacketSize]")'  
}

---

<div class="post-metadata">

**Author:** ![Melpheos](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@Melpheos](https://discuss.elastic.co/u/Melpheos)\
**Post date:** [February 17, 2017, 11:15am UTC](https://discuss.elastic.co/t/stuck-with-ruby-socketerror/72490/2 "2017-02-17T11:15:14Z")

</div>

Same error with latest version

[2017-02-17T13:07:29,416][WARN][logstash.inputs.udp] UDP listener died {:exception=\>#\<Errno::EBADF: Bad file descriptor - Bad file descriptor\>, :backtrace=\>["org/jruby/RubyIO.java:3705:in `select'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:93:in`udp\_listener'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-udp-3.1.0/lib/logstash/inputs/udp.rb:56:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:370:in`inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:364:in `start\_input'"]}

---

<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:** [March 17, 2017, 11:15am UTC](https://discuss.elastic.co/t/stuck-with-ruby-socketerror/72490/3 "2017-03-17T11:15:20Z")

</div>

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