logstash-input-beats 2.2.9 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/Gemfile +3 -1
- data/lib/logstash/inputs/beats_support/decoded_event_transform.rb +2 -2
- data/lib/logstash/inputs/beats_support/event_transform_common.rb +3 -3
- data/lib/lumberjack/beats/server.rb +1 -2
- data/logstash-input-beats.gemspec +2 -2
- data/spec/inputs/beats_spec.rb +1 -1
- data/spec/inputs/beats_support/connection_handler_spec.rb +4 -4
- data/spec/inputs/beats_support/decoded_event_transform_spec.rb +7 -7
- data/spec/inputs/beats_support/raw_event_transform_spec.rb +1 -1
- data/spec/support/integration_shared_context.rb +1 -1
- data/spec/support/shared_examples.rb +4 -4
- metadata +38 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01c01cb2565051da88d3a40968123281c37e48af
|
4
|
+
data.tar.gz: aa303cdb8a24c85f59cd14c41710c3d850887d16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00a634314cccc966f7b8b6c5c32ebebf16d71affff752fd252e10678c7d6f884491a26dec49136190a0ac40234c7f2ae90148fc9be48367829ae29b9add348a
|
7
|
+
data.tar.gz: c5fbd85b44cce829a39e53f82132a021fe76aaaa772f83c47ec13f66053af4168b86cfda18d64b591844e7be94babbda1e57ed23452da7815a799ffa614a64d3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
-
|
1
|
+
## 3.0.0
|
2
|
+
- Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
|
3
3
|
# 2.2.8
|
4
4
|
- Fix #73 Bug in EventTransformCommon#codec_name, use config_name
|
5
5
|
- Add regression test for fix to #73
|
data/Gemfile
CHANGED
@@ -8,8 +8,8 @@ module LogStash::Inputs::BeatsSupport
|
|
8
8
|
def transform(event, hash)
|
9
9
|
ts = coerce_ts(hash.delete("@timestamp"))
|
10
10
|
|
11
|
-
event
|
12
|
-
hash.each { |k, v| event
|
11
|
+
event.set("@timestamp", ts) unless ts.nil?
|
12
|
+
hash.each { |k, v| event.set(k, v) }
|
13
13
|
super(event)
|
14
14
|
event.tag("beats_input_codec_#{codec_name}_applied")
|
15
15
|
event
|
@@ -12,10 +12,10 @@ module LogStash::Inputs::BeatsSupport
|
|
12
12
|
# Copies the beat.hostname field into the host field unless
|
13
13
|
# the host field is already defined
|
14
14
|
def copy_beat_hostname(event)
|
15
|
-
host = event
|
15
|
+
host = event.get("[beat][hostname]")
|
16
16
|
|
17
|
-
if host && event
|
18
|
-
event
|
17
|
+
if host && event.get("host").nil?
|
18
|
+
event.set("host", host)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "logstash-input-beats"
|
3
|
-
s.version = '
|
3
|
+
s.version = '3.0.0'
|
4
4
|
s.licenses = ["Apache License (2.0)"]
|
5
5
|
s.summary = "Receive events using the lumberjack protocol."
|
6
6
|
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"
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
20
20
|
|
21
21
|
# Gem dependencies
|
22
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "~>
|
22
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
23
23
|
|
24
24
|
s.add_runtime_dependency "logstash-codec-plain"
|
25
25
|
s.add_runtime_dependency "concurrent-ruby", [ ">= 0.9.2", "<= 1.0.0" ]
|
data/spec/inputs/beats_spec.rb
CHANGED
@@ -147,7 +147,7 @@ describe LogStash::Inputs::Beats do
|
|
147
147
|
plugin.handle_new_connection(connection)
|
148
148
|
|
149
149
|
event = pipeline_queue.shift
|
150
|
-
expect(event
|
150
|
+
expect(event.get("tags")).to include("beats_input_flushed_by_end_of_connection")
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
@@ -51,8 +51,8 @@ describe LogStash::Inputs::BeatsSupport::ConnectionHandler do
|
|
51
51
|
subject.process(map, identity_stream)
|
52
52
|
event = queue.take
|
53
53
|
|
54
|
-
expect(event
|
55
|
-
expect(event
|
54
|
+
expect(event.get("hello")).to eq(map["hello"])
|
55
|
+
expect(event.get("tags")).to include("beats_input_raw_event")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -75,8 +75,8 @@ describe LogStash::Inputs::BeatsSupport::ConnectionHandler do
|
|
75
75
|
subject.process(map, identity_stream)
|
76
76
|
event = queue.take
|
77
77
|
|
78
|
-
expect(event
|
79
|
-
expect(event
|
78
|
+
expect(event.get("message")).to eq(message)
|
79
|
+
expect(event.get("tags")).to include("beats_input_codec_plain_applied")
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -32,12 +32,12 @@ describe LogStash::Inputs::BeatsSupport::DecodedEventTransform do
|
|
32
32
|
include_examples "Common Event Transformation"
|
33
33
|
|
34
34
|
it "tags the event" do
|
35
|
-
expect(subject
|
35
|
+
expect(subject.get("tags")).to include("beats_input_codec_plain_applied")
|
36
36
|
end
|
37
37
|
|
38
38
|
it "merges the other data from the map to the event" do
|
39
|
-
expect(subject
|
40
|
-
expect(subject
|
39
|
+
expect(subject.get("super")).to eq(map["super"])
|
40
|
+
expect(subject.get("@metadata")).to include(map["@metadata"])
|
41
41
|
end
|
42
42
|
|
43
43
|
context "map contains a timestamp" do
|
@@ -46,7 +46,7 @@ describe LogStash::Inputs::BeatsSupport::DecodedEventTransform do
|
|
46
46
|
let(:map) { super.merge({"@timestamp" => timestamp }) }
|
47
47
|
|
48
48
|
it "uses as the event timestamp" do
|
49
|
-
expect(subject
|
49
|
+
expect(subject.get("@timestamp")).to eq(LogStash::Timestamp.coerce(timestamp))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,21 +54,21 @@ describe LogStash::Inputs::BeatsSupport::DecodedEventTransform do
|
|
54
54
|
let(:map) { super.merge({"@timestamp" => "invalid" }) }
|
55
55
|
|
56
56
|
it "fallback the current time" do
|
57
|
-
expect(subject
|
57
|
+
expect(subject.get("@timestamp")).to be_kind_of(LogStash::Timestamp)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
context "when the map doesn't provide a timestamp" do
|
63
63
|
it "fallback the current time" do
|
64
|
-
expect(subject
|
64
|
+
expect(subject.get("@timestamp")).to be_kind_of(LogStash::Timestamp)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
context "when the codec is a base_codec wrapper" do
|
69
69
|
before { config.update("codec" => BeatsInputTest::DummyCodec.new) }
|
70
70
|
it "gets the codec config name from the base codec" do
|
71
|
-
expect(subject
|
71
|
+
expect(subject.get("tags")).to include("beats_input_codec_dummy_applied")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -21,6 +21,6 @@ describe LogStash::Inputs::BeatsSupport::RawEventTransform do
|
|
21
21
|
include_examples "Common Event Transformation"
|
22
22
|
|
23
23
|
it "tags the event" do
|
24
|
-
expect(subject
|
24
|
+
expect(subject.get("tags")).to include("beats_input_raw_event")
|
25
25
|
end
|
26
26
|
end
|
@@ -4,7 +4,7 @@ require "flores/random"
|
|
4
4
|
shared_examples "send events" do
|
5
5
|
it "successfully send the events" do
|
6
6
|
wait(20).for { queue.size }.to eq(number_of_events), "Expected: #{number_of_events} got: #{queue.size}, execution output:\n #{@execution_output}"
|
7
|
-
expect(queue.collect { |e| e
|
7
|
+
expect(queue.collect { |e| e.get("message") }).to eq(events)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -22,7 +22,7 @@ shared_examples "Common Event Transformation" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "adds configured tags to the event" do
|
25
|
-
expect(subject
|
25
|
+
expect(subject.get("tags")).to include(tag)
|
26
26
|
end
|
27
27
|
|
28
28
|
context "when the `beast.hotname` doesnt exist on the event" do
|
@@ -30,7 +30,7 @@ shared_examples "Common Event Transformation" do
|
|
30
30
|
let(:event_map) { super.merge({ "host" => already_exist }) }
|
31
31
|
|
32
32
|
it "doesnt change the value" do
|
33
|
-
expect(subject
|
33
|
+
expect(subject.get("host")).to eq(already_exist)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ shared_examples "Common Event Transformation" do
|
|
40
40
|
|
41
41
|
context "when `host` key doesn't exist on the event" do
|
42
42
|
it "copy the `beat.hostname` to `host` or backward compatibility" do
|
43
|
-
expect(subject
|
43
|
+
expect(subject.get("host")).to eq(producer_host)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -49,7 +49,7 @@ shared_examples "Common Event Transformation" do
|
|
49
49
|
let(:event_map) { super.merge({ "host" => already_exist }) }
|
50
50
|
|
51
51
|
it "doesn't override it" do
|
52
|
-
expect(subject
|
52
|
+
expect(subject.get("host")).to eq(already_exist)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
metadata
CHANGED
@@ -1,44 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-beats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
19
|
-
name: logstash-core-plugin-api
|
20
|
-
prerelease: false
|
19
|
+
version: '2.0'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: logstash-codec-plain
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
name: logstash-codec-plain
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: concurrent-ruby
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
@@ -47,9 +48,8 @@ dependencies:
|
|
47
48
|
- - "<="
|
48
49
|
- !ruby/object:Gem::Version
|
49
50
|
version: 1.0.0
|
50
|
-
name: concurrent-ruby
|
51
|
-
prerelease: false
|
52
51
|
type: :runtime
|
52
|
+
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
@@ -59,146 +59,148 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 1.0.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
+
name: thread_safe
|
62
63
|
requirement: !ruby/object:Gem::Requirement
|
63
64
|
requirements:
|
64
65
|
- - "~>"
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: 0.3.5
|
67
|
-
name: thread_safe
|
68
|
-
prerelease: false
|
69
68
|
type: :runtime
|
69
|
+
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.3.5
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
+
name: logstash-codec-multiline
|
76
77
|
requirement: !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
79
|
- - "~>"
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
version: 2.0.5
|
81
|
-
name: logstash-codec-multiline
|
82
|
-
prerelease: false
|
83
82
|
type: :runtime
|
83
|
+
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 2.0.5
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
+
name: flores
|
90
91
|
requirement: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
93
|
- - "~>"
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: 0.0.6
|
95
|
-
name: flores
|
96
|
-
prerelease: false
|
97
96
|
type: :development
|
97
|
+
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.0.6
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
+
name: rspec
|
104
105
|
requirement: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
107
|
- - ">="
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '0'
|
109
|
-
name: rspec
|
110
|
-
prerelease: false
|
111
110
|
type: :development
|
111
|
+
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
+
name: stud
|
118
119
|
requirement: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
121
|
- - ">="
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
|
-
name: stud
|
124
|
-
prerelease: false
|
125
124
|
type: :development
|
125
|
+
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
+
name: pry
|
132
133
|
requirement: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
135
|
- - ">="
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
|
-
name: pry
|
138
|
-
prerelease: false
|
139
138
|
type: :development
|
139
|
+
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
+
name: rspec-wait
|
146
147
|
requirement: !ruby/object:Gem::Requirement
|
147
148
|
requirements:
|
148
149
|
- - ">="
|
149
150
|
- !ruby/object:Gem::Version
|
150
151
|
version: '0'
|
151
|
-
name: rspec-wait
|
152
|
-
prerelease: false
|
153
152
|
type: :development
|
153
|
+
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
+
name: logstash-devutils
|
160
161
|
requirement: !ruby/object:Gem::Requirement
|
161
162
|
requirements:
|
162
163
|
- - "~>"
|
163
164
|
- !ruby/object:Gem::Version
|
164
165
|
version: 0.0.18
|
165
|
-
name: logstash-devutils
|
166
|
-
prerelease: false
|
167
166
|
type: :development
|
167
|
+
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: 0.0.18
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
+
name: logstash-codec-json
|
174
175
|
requirement: !ruby/object:Gem::Requirement
|
175
176
|
requirements:
|
176
177
|
- - ">="
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
|
-
name: logstash-codec-json
|
180
|
-
prerelease: false
|
181
180
|
type: :development
|
181
|
+
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
+
name: childprocess
|
188
189
|
requirement: !ruby/object:Gem::Requirement
|
189
190
|
requirements:
|
190
191
|
- - ">="
|
191
192
|
- !ruby/object:Gem::Version
|
192
193
|
version: '0'
|
193
|
-
name: childprocess
|
194
|
-
prerelease: false
|
195
194
|
type: :development
|
195
|
+
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
|
-
description: This gem is a Logstash plugin required to be installed on top of the
|
201
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
202
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
203
|
+
gem is not a stand-alone program
|
202
204
|
email: info@elastic.co
|
203
205
|
executables: []
|
204
206
|
extensions: []
|
@@ -251,7 +253,7 @@ licenses:
|
|
251
253
|
metadata:
|
252
254
|
logstash_plugin: 'true'
|
253
255
|
logstash_group: input
|
254
|
-
post_install_message:
|
256
|
+
post_install_message:
|
255
257
|
rdoc_options: []
|
256
258
|
require_paths:
|
257
259
|
- lib
|
@@ -266,9 +268,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
268
|
- !ruby/object:Gem::Version
|
267
269
|
version: '0'
|
268
270
|
requirements: []
|
269
|
-
rubyforge_project:
|
270
|
-
rubygems_version: 2.
|
271
|
-
signing_key:
|
271
|
+
rubyforge_project:
|
272
|
+
rubygems_version: 2.5.1
|
273
|
+
signing_key:
|
272
274
|
specification_version: 4
|
273
275
|
summary: Receive events using the lumberjack protocol.
|
274
276
|
test_files:
|