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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3d60d31b2c7e2ade8098adedf54e08c488c57a625abf96eb1fcb17763da79eb
4
- data.tar.gz: f9d189aae39a9cbfc3e733d9bed105e363ccf7933e7c48629dc4bc42811fc546
3
+ metadata.gz: a7b46a5fa704f7e6638944ab3ece1b96d972bcae84d7a35a3bf1850fde9d1c68
4
+ data.tar.gz: 8dc490e072b14ab59c7bccec084ccc02c10af576eef532ec0cf4d01faa171b43
5
5
  SHA512:
6
- metadata.gz: d170acccfdafc9bc6d848de05dddc6c0e40f0bd4a995341375783eb8ab04d2fc4a4e201b711c5165e2e9011a62aba54c2574462645a74a6dc29c188d85b333a9
7
- data.tar.gz: af487455cec1b076d84e428d0769ced95f9f1cf64ec2cee5a52e965dc384a1e3416aff90e425084530f005bea2a3513bba46782f96567bf8c2a5b510cb7be9b1
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)
@@ -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 }
@@ -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.0'
4
+ s.version = '3.1.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
- s.summary = "Reads JSON formatted content, creating one event per element in a JSON array"
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'
@@ -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.0
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: 2021-07-01 00:00:00.000000000 Z
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
- rubyforge_project:
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, creating one event per element in a JSON array
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