From c87bd7de7c6e5734495c5d1895e883483d077673 Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Mon, 17 Sep 2018 11:02:42 +0000 Subject: [PATCH 1/2] fix log being truncated by increasing max size --- lib/remote_syslog_logger/udp_sender.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/remote_syslog_logger/udp_sender.rb b/lib/remote_syslog_logger/udp_sender.rb index 867de4a..3543245 100644 --- a/lib/remote_syslog_logger/udp_sender.rb +++ b/lib/remote_syslog_logger/udp_sender.rb @@ -7,6 +7,7 @@ def initialize(remote_hostname, remote_port, options = {}) @remote_hostname = remote_hostname @remote_port = remote_port @whinyerrors = options[:whinyerrors] + @maxsize = options[:maxsize] || 30720 @socket = UDPSocket.new @packet = SyslogProtocol::Packet.new @@ -26,7 +27,8 @@ def transmit(message) next if line =~ /^\s*$/ packet = @packet.dup packet.content = line - @socket.send(packet.assemble, 0, @remote_hostname, @remote_port) + payload = packet.assemble @maxsize + @socket.send(payload, 0, @remote_hostname, @remote_port) rescue $stderr.puts "#{self.class} error: #{$!.class}: #{$!}\nOriginal message: #{line}" raise if @whinyerrors From 6bcbd54ac8a07eb048acfe9713521a7c29fa37da Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Sun, 23 Sep 2018 09:11:14 +0000 Subject: [PATCH 2/2] revert to 1024 as default size --- lib/remote_syslog_logger/udp_sender.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/remote_syslog_logger/udp_sender.rb b/lib/remote_syslog_logger/udp_sender.rb index 3543245..3e243db 100644 --- a/lib/remote_syslog_logger/udp_sender.rb +++ b/lib/remote_syslog_logger/udp_sender.rb @@ -7,7 +7,7 @@ def initialize(remote_hostname, remote_port, options = {}) @remote_hostname = remote_hostname @remote_port = remote_port @whinyerrors = options[:whinyerrors] - @maxsize = options[:maxsize] || 30720 + @max_size = options[:max_size] @socket = UDPSocket.new @packet = SyslogProtocol::Packet.new @@ -27,7 +27,7 @@ def transmit(message) next if line =~ /^\s*$/ packet = @packet.dup packet.content = line - payload = packet.assemble @maxsize + payload = @max_size ? packet.assemble(@max_size) : packet.assemble @socket.send(payload, 0, @remote_hostname, @remote_port) rescue $stderr.puts "#{self.class} error: #{$!.class}: #{$!}\nOriginal message: #{line}"