logstash-codec-json 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/codecs/json.rb +1 -1
- data/logstash-codec-json.gemspec +2 -2
- data/spec/codecs/json_spec.rb +13 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b46a5fa704f7e6638944ab3ece1b96d972bcae84d7a35a3bf1850fde9d1c68
|
4
|
+
data.tar.gz: 8dc490e072b14ab59c7bccec084ccc02c10af576eef532ec0cf4d01faa171b43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb6de9751e720507a9c60234f0d6d249fd6aa9b3ef687246c68a22015d40bc2fdced1905f0e5ebcc902b98c8ed9052cd7743182ecd25064cd98e2d1e59435a0
|
7
|
+
data.tar.gz: c347d72d75821502694f16439faf146c1f9d064964f0fe5b428ea487e570e072cd3cbf79ca3cb0b297404f7c16a5f235a14e94936cc73f1644a38d6e917ead03
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 3.1.1
|
2
|
+
- Fix: when decoded JSON includes an `[event][original]` field, having `ecs_compatibility` enabled will no longer overwrite the decoded field [#43](https://github.com/logstash-plugins/logstash-codec-json/pull/43)
|
3
|
+
|
1
4
|
## 3.1.0
|
2
5
|
- Feat: event `target => namespace` support (for ECS) [#37](https://github.com/logstash-plugins/logstash-codec-json/pull/37)
|
3
6
|
- Refactor: dropped support for old Logstash versions (< 6.0)
|
data/lib/logstash/codecs/json.rb
CHANGED
@@ -75,7 +75,7 @@ class LogStash::Codecs::JSON < LogStash::Codecs::Base
|
|
75
75
|
events = events_from_json(json, targeted_event_factory)
|
76
76
|
if events.size == 1
|
77
77
|
event = events.first
|
78
|
-
event.set(@original_field, json.dup.freeze) if @original_field
|
78
|
+
event.set(@original_field, json.dup.freeze) if @original_field && !event.include?(@original_field)
|
79
79
|
yield event
|
80
80
|
else
|
81
81
|
events.each { |event| yield event }
|
data/logstash-codec-json.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-json'
|
4
|
-
s.version = '3.1.
|
4
|
+
s.version = '3.1.1'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
|
-
s.summary = "Reads JSON formatted content
|
6
|
+
s.summary = "Reads and writes JSON formatted content; one event per element in a JSON array"
|
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"]
|
9
9
|
s.email = 'info@elastic.co'
|
data/spec/codecs/json_spec.rb
CHANGED
@@ -222,6 +222,19 @@ describe LogStash::Codecs::JSON, :ecs_compatibility_support do
|
|
222
222
|
|
223
223
|
end
|
224
224
|
|
225
|
+
context 'when JSON-coded event includes [event][original]' do
|
226
|
+
let(:message) { ' { "foo": "bar", "baz": { "0": [1, 2, 3], "1": true }, "event" : { "original" : "actual_original" } } ' }
|
227
|
+
|
228
|
+
it 'does not overwrite [event][original]' do
|
229
|
+
count = 0
|
230
|
+
subject.decode(message) do |event|
|
231
|
+
count += 1
|
232
|
+
expect( event.get('[event][original]') ).to eq("actual_original")
|
233
|
+
end
|
234
|
+
expect( count ).to eql 1
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
225
238
|
end
|
226
239
|
end
|
227
240
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,10 +145,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.6.13
|
148
|
+
rubygems_version: 3.1.6
|
150
149
|
signing_key:
|
151
150
|
specification_version: 4
|
152
|
-
summary: Reads JSON formatted content
|
151
|
+
summary: Reads and writes JSON formatted content; one event per element in a JSON
|
152
|
+
array
|
153
153
|
test_files:
|
154
154
|
- spec/codecs/json_spec.rb
|