File tree Expand file tree Collapse file tree 5 files changed +32
-3
lines changed Expand file tree Collapse file tree 5 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 16
16
- Fix user agent populated in headers
17
17
## 2.0.0
18
18
- Dont send event metadata by default. Add config include_metadata_keys for including custom metadata
19
+ ## 2.0.1
20
+ - Fix incomplete json metadata error.
Original file line number Diff line number Diff line change 1
1
# FROM jruby:9.3.9.0-jdk11
2
- FROM logstash:8.5.1 AS builder
2
+ FROM logstash:8.11.3 AS builder
3
3
4
4
FROM jruby:9.3.9.0-jdk11
5
5
COPY --from=builder /usr/share/logstash /logstash
Original file line number Diff line number Diff line change @@ -298,7 +298,12 @@ def processEvent(event)
298
298
elsif @final_metadata_keys
299
299
@final_metadata_keys . each do | key , value |
300
300
nestedVal = event_json
301
- value . each { |x | nestedVal = nestedVal [ x ] }
301
+ value . each do |x |
302
+ if nestedVal == nil
303
+ break
304
+ end
305
+ nestedVal = nestedVal [ x ]
306
+ end
302
307
if nestedVal != nil
303
308
lmlogs_event [ key ] = nestedVal
304
309
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module LmLogsLogstashPlugin
4
- VERSION = '2.0.0 '
4
+ VERSION = '2.0.1 '
5
5
end
Original file line number Diff line number Diff line change @@ -83,4 +83,26 @@ def check_same_hash(h1,h2)
83
83
puts " hash diff : #{ Hashdiff . diff ( constructed_event , expected_event ) } "
84
84
expect ( Hashdiff . diff ( constructed_event , expected_event ) ) . to eq ( [ ] )
85
85
end
86
+
87
+ it "Netsted key that doesn not exist should not break" do
88
+ plugin = create_output_plugin_with_conf ( {
89
+ "portal_name" => "localhost" ,
90
+ "access_id" => "abcd" ,
91
+ "access_key" => "abcd" ,
92
+ "lm_property" => "system.hostname" ,
93
+ "property_key" => "host" ,
94
+ "include_metadata_keys" => %w[ nested1.nested2.nestedkey_that_doesnt_exist ]
95
+ } )
96
+ constructed_event = plugin . processEvent ( logstash_event )
97
+ expected_event = {
98
+ "message" => "hello this is log 1" ,
99
+ "timestamp" => logstash_event . timestamp ,
100
+ "_lm.resourceId" => { "system.hostname" => "host1" }
101
+ }
102
+ puts " actual : #{ constructed_event } \n expected : #{ expected_event } "
103
+ puts " hash diff : #{ Hashdiff . diff ( constructed_event , expected_event ) } "
104
+ expect ( Hashdiff . diff ( constructed_event , expected_event ) ) . to eq ( [ ] )
105
+ end
106
+
107
+
86
108
end
You can’t perform that action at this time.
0 commit comments