logstash-codec-rfc6587 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dd0b560d12d487e1dc9e3f6b8b3cbf9a43587f892a3fac6ba55f933b0c9475b
4
- data.tar.gz: ba87571c3cdb4e1b5dc1f9b119ffb0fa294ddb6397c8be2417c64ba7972d2485
3
+ metadata.gz: 15099317e64a62990e4c3f58872acd7c75e3efbc384343052a078003ce1260f3
4
+ data.tar.gz: 25eeec0596b026729fd2d0982609de06c77171c33cb7647a4a7377024663747e
5
5
  SHA512:
6
- metadata.gz: '069a119e9bcfb4c608aff665f1b27cebac0c686b3c67baf76456fe32187ec5dfaf6ae4aae1d2bbf14e28cf66cd01a7943decb309e29a6acd950dcd558f42e30f'
7
- data.tar.gz: 97ce3065ac9225881d3cf603387871e8fab660b2a285740824266f9cc2f65bb79ec56bbe0fe53cea1edac3fb54874d3c2d2a4fc591e66996c95bf210902a74e9
6
+ metadata.gz: 8da66783b0b0326f11d507ba5cbc024ef871a62bda77bcbc6bdc7cfcdf210a77bdaae1d33d128ca7998261d5904854d83a2707ebea7aae822379c911ebaed1d0
7
+ data.tar.gz: 9667b5c7002f3739b9d4175931375c165ba17119e8b4884296336af5d495b86fbd69f85af1d8ae38bbf76a5096b639030cb9766cf46acad8d4d7ff01d8443978
@@ -49,6 +49,7 @@ class LogStash::Codecs::Rfc6587 < LogStash::Codecs::Base
49
49
  def read(data)
50
50
  header = ""
51
51
  while c = data.read(1)
52
+ next if ["\0", "\x00"].include?(c) # ignore null characters
52
53
  raise "Unknown header character '#{c}'" if not [@delimiter, nil, c.to_i.to_s].include?(c)
53
54
  header += c if c
54
55
  break if c == @delimiter or data.eof or c == nil
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-rfc6587'
4
- s.version = '0.1.0'
4
+ s.version = '0.1.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads lines as described in rfc6587"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
8
8
  s.authors = ["Elastic", "ThePsyjo"]
9
9
  s.email = 'info@elastic.co'
10
- s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
+ s.homepage = "https://github.com/ThePsyjo/logstash-codec-rfc6587"
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
@@ -49,6 +49,7 @@ describe LogStash::Codecs::Rfc6587, :ecs_compatibility_support do
49
49
  #end
50
50
 
51
51
  context "#decode" do
52
+
52
53
  it "should return an event from an ascii string" do
53
54
  decoded = false
54
55
  subject.decode("11 hello world") do |e|
@@ -59,6 +60,33 @@ describe LogStash::Codecs::Rfc6587, :ecs_compatibility_support do
59
60
  insist { decoded } == true
60
61
  end
61
62
 
63
+ it "should return nothing if input data is empty" do
64
+ decoded = false
65
+ subject.decode("") do |e|
66
+ decoded = true
67
+ end
68
+ insist { decoded } == false
69
+ end
70
+
71
+ it "should return nothing if input data is only '\\0' or '\\x00'" do
72
+ decoded = false
73
+ subject.decode("\0\x00") do |e|
74
+ decoded = true
75
+ end
76
+ insist { decoded } == false
77
+ end
78
+
79
+ it "should return an event from an ascii string prefixed with \\0" do
80
+ decoded = false
81
+ subject.decode("\x004 test") do |e|
82
+ decoded = true
83
+ insist { e.is_a?(LogStash::Event) }
84
+ insist { e.get("message") } == "test"
85
+ end
86
+ insist { decoded } == true
87
+ end
88
+
89
+
62
90
  ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
63
91
 
64
92
  before(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-rfc6587
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-06 00:00:00.000000000 Z
12
+ date: 2024-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +105,7 @@ files:
105
105
  - lib/logstash/codecs/rfc6587.rb
106
106
  - logstash-codec-rfc6587.gemspec
107
107
  - spec/codecs/rfc6587_spec.rb
108
- homepage: http://www.elastic.co/guide/en/logstash/current/index.html
108
+ homepage: https://github.com/ThePsyjo/logstash-codec-rfc6587
109
109
  licenses:
110
110
  - Apache License (2.0)
111
111
  metadata: