logstash-output-elasticsearch 2.0.0.pre.beta-java → 2.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/lib/logstash/outputs/elasticsearch.rb +113 -140
- data/lib/logstash/outputs/elasticsearch/http_client.rb +74 -36
- data/logstash-output-elasticsearch.gemspec +6 -5
- data/spec/es_spec_helper.rb +1 -0
- data/spec/integration/outputs/index_spec.rb +18 -36
- data/spec/integration/outputs/retry_spec.rb +16 -6
- data/spec/integration/outputs/routing_spec.rb +20 -39
- data/spec/unit/outputs/elasticsearch/protocol_spec.rb +31 -16
- data/spec/unit/outputs/elasticsearch_proxy_spec.rb +1 -1
- data/spec/unit/outputs/elasticsearch_spec.rb +50 -2
- metadata +61 -49
- data/.gitignore +0 -5
- data/Rakefile +0 -1
@@ -37,7 +37,7 @@ describe "Proxy option" do
|
|
37
37
|
let(:proxy) { {"hosts" => "127.0.0.1", "protocol" => "http"} }
|
38
38
|
|
39
39
|
it "should pass through the proxy values as symbols" do
|
40
|
-
expected = {:
|
40
|
+
expected = {:hosts => proxy["hosts"], :protocol => proxy["protocol"]}
|
41
41
|
expect(::Elasticsearch::Client).to have_received(:new) do |options|
|
42
42
|
expect(options[:transport_options][:proxy]).to eql(expected)
|
43
43
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "../../../spec/es_spec_helper"
|
2
|
+
require "flores/random"
|
2
3
|
|
3
4
|
describe "outputs/elasticsearch" do
|
4
5
|
describe "http client create" do
|
@@ -8,7 +9,7 @@ describe "outputs/elasticsearch" do
|
|
8
9
|
let(:options) {
|
9
10
|
{
|
10
11
|
"index" => "my-index",
|
11
|
-
"hosts" => "localhost",
|
12
|
+
"hosts" => ["localhost","localhost:9202"],
|
12
13
|
"path" => "some-path"
|
13
14
|
}
|
14
15
|
}
|
@@ -30,7 +31,6 @@ describe "outputs/elasticsearch" do
|
|
30
31
|
expect(eso.path).to eql(options["path"])
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
34
|
it "should properly set the path on the HTTP client adding slashes" do
|
35
35
|
expect(manticore_host).to include("/" + options["path"] + "/")
|
36
36
|
end
|
@@ -45,8 +45,56 @@ describe "outputs/elasticsearch" do
|
|
45
45
|
expect(manticore_host).to include(options["path"])
|
46
46
|
end
|
47
47
|
end
|
48
|
+
end
|
49
|
+
describe "without a port specified" do
|
50
|
+
it "should properly set the default port (9200) on the HTTP client" do
|
51
|
+
expect(manticore_host).to include("9200")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
describe "with a port other than 9200 specified" do
|
55
|
+
let(:manticore_host) {
|
56
|
+
eso.client.send(:client).transport.options[:hosts].last
|
57
|
+
}
|
58
|
+
it "should properly set the specified port on the HTTP client" do
|
59
|
+
expect(manticore_host).to include("9202")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# TODO(sissel): Improve this. I'm not a fan of using message expectations (expect().to receive...)
|
65
|
+
# especially with respect to logging to verify a failure/retry has occurred. For now, this
|
66
|
+
# should suffice, though.
|
67
|
+
context "with timeout set" do
|
68
|
+
let(:listener) { Flores::Random.tcp_listener }
|
69
|
+
let(:port) { listener[2] }
|
70
|
+
let(:options) do
|
71
|
+
{
|
72
|
+
"manage_template" => false,
|
73
|
+
"hosts" => "localhost:#{port}",
|
74
|
+
"flush_size" => 1,
|
75
|
+
"timeout" => 0.1, # fast timeout
|
76
|
+
}
|
77
|
+
end
|
78
|
+
let(:eso) {LogStash::Outputs::ElasticSearch.new(options)}
|
79
|
+
|
80
|
+
before do
|
81
|
+
eso.register
|
82
|
+
|
83
|
+
# Expect a timeout to be logged.
|
84
|
+
expect(eso.logger).to receive(:warn).with("Failed to flush outgoing items",
|
85
|
+
hash_including(:exception => "Manticore::SocketTimeout"))
|
86
|
+
end
|
87
|
+
|
88
|
+
after do
|
89
|
+
listener[0].close
|
90
|
+
eso.close
|
91
|
+
end
|
48
92
|
|
93
|
+
it "should fail after the timeout" do
|
94
|
+
Thread.new { eso.receive(LogStash::Event.new) }
|
49
95
|
|
96
|
+
# Allow the timeout to occur.
|
97
|
+
sleep(options["timeout"] + 0.3)
|
50
98
|
end
|
51
99
|
end
|
52
100
|
end
|
metadata
CHANGED
@@ -1,50 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
14
20
|
requirement: !ruby/object:Gem::Requirement
|
15
21
|
requirements:
|
16
22
|
- - '>='
|
17
23
|
- !ruby/object:Gem::Version
|
18
24
|
version: '0'
|
19
|
-
name: concurrent-ruby
|
20
25
|
prerelease: false
|
21
26
|
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: elasticsearch
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
31
|
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
-
|
33
|
+
version: 1.0.13
|
34
|
+
- - ~>
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '1.0'
|
28
37
|
requirement: !ruby/object:Gem::Requirement
|
29
38
|
requirements:
|
30
39
|
- - '>='
|
31
40
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.
|
41
|
+
version: 1.0.13
|
33
42
|
- - ~>
|
34
43
|
- !ruby/object:Gem::Version
|
35
44
|
version: '1.0'
|
36
|
-
name: elasticsearch
|
37
45
|
prerelease: false
|
38
46
|
type: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: stud
|
39
49
|
version_requirements: !ruby/object:Gem::Requirement
|
40
50
|
requirements:
|
41
51
|
- - '>='
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
53
|
+
version: 0.0.17
|
44
54
|
- - ~>
|
45
55
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
-
- !ruby/object:Gem::Dependency
|
56
|
+
version: '0.0'
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
58
|
requirements:
|
50
59
|
- - '>='
|
@@ -53,135 +62,138 @@ dependencies:
|
|
53
62
|
- - ~>
|
54
63
|
- !ruby/object:Gem::Version
|
55
64
|
version: '0.0'
|
56
|
-
name: stud
|
57
65
|
prerelease: false
|
58
66
|
type: :runtime
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: cabin
|
59
69
|
version_requirements: !ruby/object:Gem::Requirement
|
60
70
|
requirements:
|
61
|
-
- - '>='
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 0.0.17
|
64
71
|
- - ~>
|
65
72
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
67
|
-
- !ruby/object:Gem::Dependency
|
73
|
+
version: '0.6'
|
68
74
|
requirement: !ruby/object:Gem::Requirement
|
69
75
|
requirements:
|
70
76
|
- - ~>
|
71
77
|
- !ruby/object:Gem::Version
|
72
78
|
version: '0.6'
|
73
|
-
name: cabin
|
74
79
|
prerelease: false
|
75
80
|
type: :runtime
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: logstash-core
|
76
83
|
version_requirements: !ruby/object:Gem::Requirement
|
77
84
|
requirements:
|
78
|
-
- -
|
85
|
+
- - '>='
|
79
86
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
81
|
-
-
|
87
|
+
version: 2.0.0.snapshot
|
88
|
+
- - <
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 3.0.0
|
82
91
|
requirement: !ruby/object:Gem::Requirement
|
83
92
|
requirements:
|
84
93
|
- - '>='
|
85
94
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
95
|
+
version: 2.0.0.snapshot
|
87
96
|
- - <
|
88
97
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
name: logstash-core
|
98
|
+
version: 3.0.0
|
91
99
|
prerelease: false
|
92
100
|
type: :runtime
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: ftw
|
93
103
|
version_requirements: !ruby/object:Gem::Requirement
|
94
104
|
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: 1.4.0
|
98
|
-
- - <
|
105
|
+
- - ~>
|
99
106
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
101
|
-
- !ruby/object:Gem::Dependency
|
107
|
+
version: 0.0.42
|
102
108
|
requirement: !ruby/object:Gem::Requirement
|
103
109
|
requirements:
|
104
110
|
- - ~>
|
105
111
|
- !ruby/object:Gem::Version
|
106
112
|
version: 0.0.42
|
107
|
-
name: ftw
|
108
113
|
prerelease: false
|
109
114
|
type: :development
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: logstash-codec-plain
|
110
117
|
version_requirements: !ruby/object:Gem::Requirement
|
111
118
|
requirements:
|
112
|
-
- -
|
119
|
+
- - '>='
|
113
120
|
- !ruby/object:Gem::Version
|
114
|
-
version: 0
|
115
|
-
- !ruby/object:Gem::Dependency
|
121
|
+
version: '0'
|
116
122
|
requirement: !ruby/object:Gem::Requirement
|
117
123
|
requirements:
|
118
124
|
- - '>='
|
119
125
|
- !ruby/object:Gem::Version
|
120
126
|
version: '0'
|
121
|
-
name: logstash-input-generator
|
122
127
|
prerelease: false
|
123
128
|
type: :development
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: manticore
|
124
131
|
version_requirements: !ruby/object:Gem::Requirement
|
125
132
|
requirements:
|
126
|
-
- -
|
133
|
+
- - ~>
|
127
134
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
129
|
-
- !ruby/object:Gem::Dependency
|
135
|
+
version: 0.4.2
|
130
136
|
requirement: !ruby/object:Gem::Requirement
|
131
137
|
requirements:
|
132
138
|
- - ~>
|
133
139
|
- !ruby/object:Gem::Version
|
134
140
|
version: 0.4.2
|
135
|
-
name: manticore
|
136
141
|
prerelease: false
|
137
142
|
type: :runtime
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: logstash-devutils
|
138
145
|
version_requirements: !ruby/object:Gem::Requirement
|
139
146
|
requirements:
|
140
|
-
- -
|
147
|
+
- - '>='
|
141
148
|
- !ruby/object:Gem::Version
|
142
|
-
version: 0
|
143
|
-
- !ruby/object:Gem::Dependency
|
149
|
+
version: '0'
|
144
150
|
requirement: !ruby/object:Gem::Requirement
|
145
151
|
requirements:
|
146
152
|
- - '>='
|
147
153
|
- !ruby/object:Gem::Version
|
148
154
|
version: '0'
|
149
|
-
name: logstash-devutils
|
150
155
|
prerelease: false
|
151
156
|
type: :development
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: longshoreman
|
152
159
|
version_requirements: !ruby/object:Gem::Requirement
|
153
160
|
requirements:
|
154
161
|
- - '>='
|
155
162
|
- !ruby/object:Gem::Version
|
156
163
|
version: '0'
|
157
|
-
- !ruby/object:Gem::Dependency
|
158
164
|
requirement: !ruby/object:Gem::Requirement
|
159
165
|
requirements:
|
160
166
|
- - '>='
|
161
167
|
- !ruby/object:Gem::Version
|
162
168
|
version: '0'
|
163
|
-
name: longshoreman
|
164
169
|
prerelease: false
|
165
170
|
type: :development
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
name: flores
|
166
173
|
version_requirements: !ruby/object:Gem::Requirement
|
167
174
|
requirements:
|
168
175
|
- - '>='
|
169
176
|
- !ruby/object:Gem::Version
|
170
177
|
version: '0'
|
178
|
+
requirement: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
prerelease: false
|
184
|
+
type: :development
|
171
185
|
description: Output events to elasticsearch
|
172
186
|
email: info@elastic.co
|
173
187
|
executables: []
|
174
188
|
extensions: []
|
175
189
|
extra_rdoc_files: []
|
176
190
|
files:
|
177
|
-
- .gitignore
|
178
191
|
- CHANGELOG.md
|
179
192
|
- CONTRIBUTORS
|
180
193
|
- Gemfile
|
181
194
|
- LICENSE
|
182
195
|
- NOTICE.TXT
|
183
196
|
- README.md
|
184
|
-
- Rakefile
|
185
197
|
- lib/logstash/outputs/elasticsearch.rb
|
186
198
|
- lib/logstash/outputs/elasticsearch/elasticsearch-template.json
|
187
199
|
- lib/logstash/outputs/elasticsearch/http_client.rb
|
@@ -215,12 +227,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
227
|
version: '0'
|
216
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
229
|
requirements:
|
218
|
-
- - '
|
230
|
+
- - '>='
|
219
231
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
232
|
+
version: '0'
|
221
233
|
requirements: []
|
222
234
|
rubyforge_project:
|
223
|
-
rubygems_version: 2.4.
|
235
|
+
rubygems_version: 2.4.5
|
224
236
|
signing_key:
|
225
237
|
specification_version: 4
|
226
238
|
summary: Logstash Output to Elasticsearch
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rake"
|