Logstash and Lumberjack giving Error

Hello,

I am facing this error quite often and it happens randomly too. My logs seem to be flowing fine and then suddenly it stops and I get the below error.

[ERROR][logstash.outputs.lumberjack][main] All hosts unavailable, sleeping {:hosts=>["hostname"], :e=>#<RuntimeError: Could not connect to any hosts>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/jls-lumberjack-0.0.26/lib/lumberjack/client.rb:31:in connect'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/jls-lumberjack-0.0.26/lib/lumberjack/client.rb:24:ininitialize'","/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-lumberjack-3.1.7/lib/logstash/outputs/lumberjack.rb:86:in connect'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-lumberjack-3.1.7/lib/logstash/outputs/lumberjack.rb:69:in flush'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/buffer.rb:219:in block in buffer_flush'", "org/jruby/RubyHash.java:1415:ineach'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/buffer.rb:216:inbuffer_flush'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/buffer.rb:159:inbuffer_receive'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-lumberjack-3.1.7/lib/logstash/outputs/lumberjack.rb:52:in block in register'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-codec-json-3.0.5/lib/logstash/codecs/json.rb:42:inencode'", "/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:48:inblock in encode'", "org/logstash/instrument/metrics/AbstractSimpleMetricExt.java:65:intime'", "org/logstash/instrument/metrics/AbstractNamespacedMetricExt.java:64:intime'", "/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:47:inencode'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-lumberjack-3.1.7/lib/logstash/outputs/lumberjack.rb:59:inreceive'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:105:inblock in multi_receive'", "org/jruby/RubyArray.java:1809:ineach'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:105:inmulti_receive'", "org/logstash/config/ir/compiler/OutputStrategyExt.java:143:in multi_receive'", "org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:121:inmulti_receive'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:295:in
`block in start_workers'"]}

What does this error mean and what could be causing it?