Logstash to logstash communication

Hi,
I am sending logs from one logstash to another through TCP or UDP. Earlier I tried with TCP i got error which posted at https://discuss.elastic.co/t/eoferror-end-of-file-reached/204933 so switched to UDP but now I am getting

org.jruby.exceptions.SystemCallError: (EMSGSIZE) Message too long - No message available
        at org.jruby.ext.socket.RubyUDPSocket.send(org/jruby/ext/socket/RubyUDPSocket.java:451) ~[jruby-complete-9.2.7.0.jar:?]
        at usr.share.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_output_minus_udp_minus_3_dot_0_dot_6.lib.logstash.outputs.udp.register(/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-udp-3.0.6/lib/logstash/outputs/udp.rb:24) ~[?:?]
        at usr.share.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_codec_minus_json_minus_3_dot_0_dot_5.lib.logstash.codecs.json.encode(/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-codec-json-3.0.5/lib/logstash/codecs/json.rb:42) ~[?:?]
        at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.delegator.encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:31) ~[?:?]
        at org.logstash.instrument.metrics.AbstractSimpleMetricExt.time(org/logstash/instrument/metrics/AbstractSimpleMetricExt.java:45) ~[logstash-core.jar:?]
        at org.logstash.instrument.metrics.AbstractNamespacedMetricExt.time(org/logstash/instrument/metrics/AbstractNamespacedMetricExt.java:44) ~[logstash-core.jar:?]
        at usr.share.logstash.logstash_minus_core.lib.logstash.codecs.delegator.encode(/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:30) ~[?:?]

And my logstash is keep-on restarting. I enable to the message size by adding small ruby code

ruby {
    code => "event.set('message_size', event.get('message').bytesize)"
}

No message is more that 65536, i am not sure how i can forward the logs now. any help will be appreciated. I checked in the network side there is no connection issue between the logstash when using UDP or TCP.