diff --git a/docs/Protocol.md b/docs/Protocol.md index 269a2eb5..1319c5bf 100644 --- a/docs/Protocol.md +++ b/docs/Protocol.md @@ -73,7 +73,13 @@ Data for this message is currently defined as follows: ```text +---+---+---+---+ -| F | M | m | p | +| Flags | ++---+---+---+---+ +| Major Version | ++---+---+---+---+ +| Minor Version | ++---+---+---+---+ +| Patch Version | +---+---+---+---+ | Client | +---+---+---+---+ @@ -81,16 +87,16 @@ Data for this message is currently defined as follows: + ``` -F = 1-byte of Bit Flags defined as follows: +Flags = 1-byte of Bit Flags defined as follows: - Bit 1: EVNT message stream is supported - Bits 2-8: Reserved -M = Major version of client +Major Version = Major version of client -m = minor version of client +Minor Version = Minor version of client -p = patch version of client +Patch Version = Patch version of client Client = 4-character ASCII identifier of the client. All "LC" prefix are reserved. See [Known Clients](#known-clients). diff --git a/ruby/log-courier/Gemfile.lock b/ruby/log-courier/Gemfile.lock index e5a9e567..d40f5ee0 100644 --- a/ruby/log-courier/Gemfile.lock +++ b/ruby/log-courier/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - log-courier (2.7.0) + log-courier (2.7.2) cabin (~> 0.6) multi_json (~> 1.10) diff --git a/ruby/log-courier/lib/log-courier/client_tcp.rb b/ruby/log-courier/lib/log-courier/client_tcp.rb index 554d0664..c1547d19 100644 --- a/ruby/log-courier/lib/log-courier/client_tcp.rb +++ b/ruby/log-courier/lib/log-courier/client_tcp.rb @@ -125,7 +125,7 @@ def resume_send def handshake(io_control) return true if @options[:disable_handshake] - @socket.write ['HELO', 8, 0, 2, 7, 0, 'RYLC'].pack('A4NCCCCA4') + @socket.write ['HELO', 20, 0, 2, 7, 2, 'RYLC'].pack('A4NNNNNA4') signature, data = receive if signature != 'VERS' diff --git a/ruby/log-courier/lib/log-courier/protocol.rb b/ruby/log-courier/lib/log-courier/protocol.rb index 34f5c5b5..c8edacb0 100644 --- a/ruby/log-courier/lib/log-courier/protocol.rb +++ b/ruby/log-courier/lib/log-courier/protocol.rb @@ -22,9 +22,9 @@ module LogCourier # Protocol module Protocol def self.parse_helo_vers(data) - data = "\x00\x00\x00\x00\x00\x00\x00\x00" if data.length < 8 + data = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" if data.length < 8 - flags, major_version, minor_version, patch_version, client = data.unpack('CCCCA4') + flags, major_version, minor_version, patch_version, client = data.unpack('NNNNA4') client = case client when 'LCOR' 'Log Courier' diff --git a/ruby/log-courier/lib/log-courier/server_tcp.rb b/ruby/log-courier/lib/log-courier/server_tcp.rb index e069f1b7..1674a743 100644 --- a/ruby/log-courier/lib/log-courier/server_tcp.rb +++ b/ruby/log-courier/lib/log-courier/server_tcp.rb @@ -368,15 +368,15 @@ def handshake @helo = Protocol.parse_helo_vers(data) @logger&.info 'Remote identified', peer: @peer, client_version: @helo[:client_version] - # Flags 1 byte - EVNT flag = 0 + # Flags 4 bytes - EVNT flag = 0 # (Significant rewrite would be required to support streaming messages as currently we read # first and then yield for processing. To support EVNT we have to move protocol parsing to # the connection layer here so we can keep reading until we reach the end of the stream) - # Major Version 1 byte - # Minor Version 1 byte - # Patch Version 1 byte + # Major Version 4 bytes + # Minor Version 4 bytes + # Patch Version 4 bytes # Client String 4 bytes - data = [1, 2, 7, 0, 'RYLC'].pack('CCCCA4') + data = [0, 2, 7, 2, 'RYLC'].pack('NNNNA4') send 'VERS', data end diff --git a/ruby/log-courier/log-courier.gemspec b/ruby/log-courier/log-courier.gemspec index 239ed7ad..cbd8ad55 100644 --- a/ruby/log-courier/log-courier.gemspec +++ b/ruby/log-courier/log-courier.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |gem| gem.name = 'log-courier' - gem.version = '2.7.1' + gem.version = '2.7.2' gem.description = 'Log Courier library' gem.summary = 'Ruby implementation of the Courier protocol' gem.homepage = 'https://github.com/driskell/ruby-log-courier' diff --git a/ruby/logstash-input-courier/Gemfile.lock b/ruby/logstash-input-courier/Gemfile.lock index 4ccd0020..a7cac599 100644 --- a/ruby/logstash-input-courier/Gemfile.lock +++ b/ruby/logstash-input-courier/Gemfile.lock @@ -1,15 +1,15 @@ PATH remote: ../log-courier specs: - log-courier (2.7.0) + log-courier (2.7.2) cabin (~> 0.6) multi_json (~> 1.10) PATH remote: . specs: - logstash-input-courier (2.7.0-java) - log-courier (~> 2.7.0) + logstash-input-courier (2.7.2-java) + log-courier (~> 2.7.2) logstash-codec-plain logstash-core-plugin-api (>= 1.60, <= 2.99) diff --git a/ruby/logstash-input-courier/logstash-input-courier.gemspec b/ruby/logstash-input-courier/logstash-input-courier.gemspec index a4eb848c..fa383fbf 100644 --- a/ruby/logstash-input-courier/logstash-input-courier.gemspec +++ b/ruby/logstash-input-courier/logstash-input-courier.gemspec @@ -1,7 +1,7 @@ # Add platform conditions around java-only dependencies so GitHub dependency chart that is MRI only (I think) still works Gem::Specification.new do |gem| gem.name = 'logstash-input-courier' - gem.version = '2.7.0' + gem.version = '2.7.2' gem.description = 'Courier Input Logstash Plugin' gem.summary = 'Receive events from Log Courier and Logstash using the Courier protocol' @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.metadata = { 'logstash_plugin' => 'true', 'logstash_group' => 'input' } - gem.add_runtime_dependency 'log-courier', '~> 2.7.0' + gem.add_runtime_dependency 'log-courier', '~> 2.7.2' gem.add_runtime_dependency 'logstash-codec-plain' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'logstash-core-plugin-api', '>= 1.60', '<= 2.99' if RUBY_PLATFORM == 'java' end