logstash-codec-json_lines 3.1.0 → 3.2.0

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: 5169e72b2dd6bd4e67d98b39d45e9774df075b494b459f17612812413f8964d4
4
- data.tar.gz: 0c8e8cdcf9507c5f16389c175e6b29460149cb9c0fa80428605099330b8d7e83
3
+ metadata.gz: d755546df11b55f67fe5d75b1062988fc8acf5f04883c0843d4dc4b67ee6e110
4
+ data.tar.gz: a3377cb9ba69e200724f4552db30541a67dd0a5174126158ce172a99e573e0d8
5
5
  SHA512:
6
- metadata.gz: a8421053d2d9387e7c9b33ad384f69f28e3fb5074a23ea9f5528d8493f81ea84e6a077e608c10550dc9496bd41fdbb75d0f0eb4a69ade501c124b34ce860b9a5
7
- data.tar.gz: 3b9cc5e8991eccb8c9d522602e8fdeaea2452bee93aad9449ebbba211cb1bcc2e69f861d26cefd810e326f9bbfe2b7e642f311ce593f1caab8a34bce3f692d57
6
+ metadata.gz: a2d11e5da18e6ab3b478122a06e4bb247f864e5921888a9e4dd8d52a963a1389a2d2b9f9812f09dcef8284006a71b97be86b62961d25d0007b3c4aee4109e199
7
+ data.tar.gz: fbbb593297ad8fc1090f98da984c1e894ec0013b84aa1eb5fdae767e2ac89093366a1e8ecddbef6c304d65cf134ca3d3961fa40b7aabf01b1991453d613660ca
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.2.0
2
+ - Add decode_size_limit_bytes option to limit the maximum size of each JSON line that can be parsed.[#43](https://github.com/logstash-plugins/logstash-codec-json_lines/pull/43)
3
+
1
4
  ## 3.1.0
2
5
  - Feat: event `target => namespace` support (ECS) [#41](https://github.com/logstash-plugins/logstash-codec-json_lines/pull/41)
3
6
  - Refactor: dropped support for old Logstash versions (< 6.0)
@@ -42,6 +42,11 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
42
42
  # Change the delimiter that separates lines
43
43
  config :delimiter, :validate => :string, :default => "\n"
44
44
 
45
+ # Maximum number of bytes for a single line before a fatal exception is raised
46
+ # which will stop Logsash.
47
+ # The default is 20MB which is quite large for a JSON document
48
+ config :decode_size_limit_bytes, :validate => :number, :default => 20 * (1024 * 1024) # 20MB
49
+
45
50
  # Defines a target field for placing decoded fields.
46
51
  # If this setting is omitted, data gets stored at the root (top level) of the event.
47
52
  # The target is only relevant while decoding data into a new event.
@@ -50,7 +55,7 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
50
55
  public
51
56
 
52
57
  def register
53
- @buffer = FileWatch::BufferedTokenizer.new(@delimiter)
58
+ @buffer = FileWatch::BufferedTokenizer.new(@delimiter, @decode_size_limit_bytes)
54
59
  @converter = LogStash::Util::Charset.new(@charset)
55
60
  @converter.logger = @logger
56
61
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-json_lines'
4
- s.version = '3.1.0'
4
+ s.version = '3.2.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads and writes newline-delimited JSON"
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"
@@ -118,6 +118,22 @@ describe LogStash::Codecs::JSONLines, :ecs_compatibility_support do
118
118
  end
119
119
  end
120
120
 
121
+ describe "decode_size_limits_bytes" do
122
+ let(:maximum_payload) { "a" * subject.decode_size_limit_bytes }
123
+
124
+ it "should not raise an error if the number of bytes is not exceeded" do
125
+ expect {
126
+ subject.decode(maximum_payload)
127
+ }.not_to raise_error
128
+ end
129
+
130
+ it "should raise an error if the max bytes are exceeded" do
131
+ expect {
132
+ subject.decode(maximum_payload << "z")
133
+ }.to raise_error(java.lang.IllegalStateException, "input buffer full")
134
+ end
135
+ end
136
+
121
137
  end
122
138
 
123
139
  context "#encode" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-json_lines
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-01 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -20,8 +20,8 @@ dependencies:
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.99'
22
22
  name: logstash-core-plugin-api
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
@@ -37,8 +37,8 @@ dependencies:
37
37
  - !ruby/object:Gem::Version
38
38
  version: '1.3'
39
39
  name: logstash-mixin-ecs_compatibility_support
40
- prerelease: false
41
40
  type: :runtime
41
+ prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
@@ -54,8 +54,8 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.0.1
56
56
  name: logstash-mixin-event_support
57
- prerelease: false
58
57
  type: :runtime
58
+ prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
@@ -71,8 +71,8 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '1.0'
73
73
  name: logstash-mixin-validator_support
74
- prerelease: false
75
74
  type: :runtime
75
+ prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
@@ -85,8 +85,8 @@ dependencies:
85
85
  - !ruby/object:Gem::Version
86
86
  version: 2.1.0
87
87
  name: logstash-codec-line
88
- prerelease: false
89
88
  type: :development
89
+ prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
@@ -99,8 +99,8 @@ dependencies:
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  name: logstash-devutils
102
- prerelease: false
103
102
  type: :development
103
+ prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
@@ -113,8 +113,8 @@ dependencies:
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  name: insist
116
- prerelease: false
117
116
  type: :development
117
+ prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
@@ -159,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubyforge_project:
163
- rubygems_version: 2.6.13
162
+ rubygems_version: 3.3.26
164
163
  signing_key:
165
164
  specification_version: 4
166
165
  summary: Reads and writes newline-delimited JSON