logstash-output-elasticsearch 9.1.1-java → 9.1.2-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 +3 -0
- data/logstash-output-elasticsearch.gemspec +5 -11
- data/spec/es_spec_helper.rb +1 -1
- data/spec/integration/outputs/compressed_indexing_spec.rb +0 -1
- data/spec/integration/outputs/create_spec.rb +1 -1
- data/spec/integration/outputs/groovy_update_spec.rb +10 -10
- data/spec/integration/outputs/ingest_pipeline_spec.rb +13 -16
- data/spec/integration/outputs/painless_update_spec.rb +12 -12
- data/spec/integration/outputs/parent_spec.rb +2 -2
- data/spec/integration/outputs/routing_spec.rb +5 -6
- data/spec/integration/outputs/templates_5x_spec.rb +14 -14
- data/spec/integration/outputs/templates_spec.rb +14 -14
- data/spec/integration/outputs/update_spec.rb +5 -5
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +1 -1
- metadata +23 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123fca22f700bc5760a15f5beaa40ecae654e6e9b39fa19a3d8662d04963ab3c
|
4
|
+
data.tar.gz: 495fa3272f872a14cd6b4361017f4cbba5d846cdad47e99321cf06ac2ce66b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae33f09690b8e90cb679a18b655f9349d6d6204bb9932d6c0ecde987c5871fbd16d60c65e66e52a5d38427a22099611bc5df4ac8ee529c98f6618e5e47a8ea5b
|
7
|
+
data.tar.gz: f2cbe7d567b6f46a3d396b2316db05499209e769415760ddda080f60366ed1e69bcd7ed64d3084742394186b9ff79650d7db7c95fab9aa3715bc074b7a2ed18e
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '9.1.
|
3
|
+
s.version = '9.1.2'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
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"
|
@@ -9,6 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = "http://logstash.net/"
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
|
12
|
+
s.platform = RUBY_PLATFORM
|
13
|
+
|
12
14
|
# Files
|
13
15
|
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
14
16
|
|
@@ -18,20 +20,12 @@ Gem::Specification.new do |s|
|
|
18
20
|
# Special flag to let us know this is actually a logstash plugin
|
19
21
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
20
22
|
|
23
|
+
s.add_runtime_dependency "manticore", '>= 0.5.4', '< 1.0.0'
|
21
24
|
s.add_runtime_dependency 'stud', ['>= 0.0.17', '~> 0.0']
|
22
25
|
s.add_runtime_dependency 'cabin', ['~> 0.6']
|
23
26
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
24
|
-
s.add_development_dependency 'ftw', '~> 0.0.42'
|
25
|
-
s.add_development_dependency 'addressable', "~> 2.3.0" # used by FTW. V 2.5.0 is ruby 2.0 only.
|
26
|
-
s.add_development_dependency 'logstash-codec-plain'
|
27
|
-
s.add_development_dependency 'json' # used by spec/unit/outputs/elasticsearch/http_client/pool_spec.rb
|
28
|
-
s.add_development_dependency 'gzip' # used by spec/integration/outputs/index_spec.rb
|
29
|
-
|
30
|
-
if RUBY_PLATFORM == 'java'
|
31
|
-
s.platform = RUBY_PLATFORM
|
32
|
-
s.add_runtime_dependency "manticore", '>= 0.5.4', '< 1.0.0'
|
33
|
-
end
|
34
27
|
|
28
|
+
s.add_development_dependency 'logstash-codec-plain'
|
35
29
|
s.add_development_dependency 'logstash-devutils'
|
36
30
|
s.add_development_dependency 'flores'
|
37
31
|
# Still used in some specs, we should remove this ASAP
|
data/spec/es_spec_helper.rb
CHANGED
@@ -38,7 +38,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
38
38
|
subject.register
|
39
39
|
subject.multi_receive([LogStash::Event.new("count" => 2)])
|
40
40
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
41
|
-
|
41
|
+
expect(r["_source"]["counter"]).to eq(3)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should increment a counter with event/doc '[data][count]' nested variable" do
|
@@ -46,7 +46,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
46
46
|
subject.register
|
47
47
|
subject.multi_receive([LogStash::Event.new("data" => { "count" => 3 })])
|
48
48
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
49
|
-
|
49
|
+
expect(r["_source"]["counter"]).to eq(4)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should increment a counter with event/doc 'count' variable with inline script" do
|
@@ -59,7 +59,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
59
59
|
subject.register
|
60
60
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
61
61
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
62
|
-
|
62
|
+
expect(r["_source"]["counter"]).to eq(4)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should increment a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
@@ -73,7 +73,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
73
73
|
subject.register
|
74
74
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
75
75
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
76
|
-
|
76
|
+
expect(r["_source"]["counter"]).to eq(4)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should, with new doc, set a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
@@ -87,7 +87,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
87
87
|
subject.register
|
88
88
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
89
89
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
90
|
-
|
90
|
+
expect(r["_source"]["counter"]).to eq(3)
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should increment a counter with event/doc 'count' variable with indexed script" do
|
@@ -101,7 +101,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
101
101
|
subject.register
|
102
102
|
subject.multi_receive([LogStash::Event.new("count" => 4 )])
|
103
103
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
104
|
-
|
104
|
+
expect(r["_source"]["counter"]).to eq(5)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -111,7 +111,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
111
111
|
subject.register
|
112
112
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
113
113
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
114
|
-
|
114
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should create new documents with event/doc as upsert" do
|
@@ -119,7 +119,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
119
119
|
subject.register
|
120
120
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
121
121
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
122
|
-
|
122
|
+
expect(r["_source"]["message"]).to eq('sample message here')
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should fail on documents with event/doc as upsert at external version" do
|
@@ -134,7 +134,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
134
134
|
subject.register
|
135
135
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
136
136
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
137
|
-
|
137
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should create new documents with event/doc as script params" do
|
@@ -143,7 +143,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
|
|
143
143
|
subject.multi_receive([LogStash::Event.new("counter" => 1)])
|
144
144
|
@es.indices.refresh
|
145
145
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
146
|
-
|
146
|
+
expect(r["_source"]["counter"]).to eq(1)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
end
|
@@ -11,7 +11,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
11
11
|
next LogStash::Outputs::ElasticSearch.new(settings)
|
12
12
|
end
|
13
13
|
|
14
|
-
let(:
|
14
|
+
let(:http_client) { Manticore::Client.new }
|
15
15
|
let(:ingest_url) { "http://#{get_host_port()}/_ingest/pipeline/apache-logs" }
|
16
16
|
let(:apache_logs_pipeline) { '
|
17
17
|
{
|
@@ -39,13 +39,10 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
39
39
|
@es.indices.delete(:index => "*") rescue nil
|
40
40
|
|
41
41
|
# delete existing ingest pipeline
|
42
|
-
|
43
|
-
ftw_client.execute(req)
|
42
|
+
http_client.delete(ingest_url).call
|
44
43
|
|
45
44
|
# register pipeline
|
46
|
-
|
47
|
-
req.headers["Content-Type"] = "application/json"
|
48
|
-
ftw_client.execute(req)
|
45
|
+
http_client.put(ingest_url, :body => apache_logs_pipeline, :headers => {"Content-Type" => "application/json" }).call
|
49
46
|
|
50
47
|
#TODO: Use esclient
|
51
48
|
#@es.ingest.put_pipeline :id => 'apache_pipeline', :body => pipeline_defintion
|
@@ -57,21 +54,21 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
57
54
|
#Wait or fail until everything's indexed.
|
58
55
|
Stud::try(20.times) do
|
59
56
|
r = @es.search
|
60
|
-
|
57
|
+
expect(r["hits"]["total"]).to eq(1)
|
61
58
|
end
|
62
59
|
end
|
63
60
|
|
64
61
|
it "indexes using the proper pipeline" do
|
65
62
|
results = @es.search(:index => 'logstash-*', :q => "message:\"netcat\"")
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
63
|
+
expect(results["hits"]["total"]).to eq(1)
|
64
|
+
expect(results["hits"]["hits"][0]["_source"]["response"]).to eq("200")
|
65
|
+
expect(results["hits"]["hits"][0]["_source"]["bytes"]).to eq("182")
|
66
|
+
expect(results["hits"]["hits"][0]["_source"]["verb"]).to eq("GET")
|
67
|
+
expect(results["hits"]["hits"][0]["_source"]["request"]).to eq("/scripts/netcat-webserver")
|
68
|
+
expect(results["hits"]["hits"][0]["_source"]["auth"]).to eq("-")
|
69
|
+
expect(results["hits"]["hits"][0]["_source"]["ident"]).to eq("-")
|
70
|
+
expect(results["hits"]["hits"][0]["_source"]["clientip"]).to eq("183.60.215.50")
|
71
|
+
expect(results["hits"]["hits"][0]["_source"]["junkfieldaaaa"]).to eq(nil)
|
75
72
|
end
|
76
73
|
end
|
77
74
|
end
|
@@ -42,7 +42,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
42
42
|
subject.register
|
43
43
|
subject.multi_receive([LogStash::Event.new("count" => 2)])
|
44
44
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
45
|
-
|
45
|
+
expect(r["_source"]["counter"]).to eq(3)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should increment a counter with event/doc '[data][count]' nested variable" do
|
@@ -50,7 +50,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
50
50
|
subject.register
|
51
51
|
subject.multi_receive([LogStash::Event.new("data" => { "count" => 3 })])
|
52
52
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
53
|
-
|
53
|
+
expect(r["_source"]["counter"]).to eq(4)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -64,7 +64,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
64
64
|
subject.register
|
65
65
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
66
66
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
67
|
-
|
67
|
+
expect(r["_source"]["counter"]).to eq(4)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should increment a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
@@ -77,7 +77,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
77
77
|
subject.register
|
78
78
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
79
79
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
80
|
-
|
80
|
+
expect(r["_source"]["counter"]).to eq(4)
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should, with new doc, set a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
@@ -90,7 +90,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
90
90
|
subject.register
|
91
91
|
subject.multi_receive([LogStash::Event.new("counter" => 3 )])
|
92
92
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
93
|
-
|
93
|
+
expect(r["_source"]["counter"]).to eq(3)
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'with an indexed script' do
|
@@ -115,7 +115,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
115
115
|
subject.register
|
116
116
|
subject.multi_receive([LogStash::Event.new("count" => 4 )])
|
117
117
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
118
|
-
|
118
|
+
expect(r["_source"]["counter"]).to eq(5)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -126,7 +126,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
126
126
|
subject.register
|
127
127
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
128
128
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
129
|
-
|
129
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
130
130
|
end
|
131
131
|
|
132
132
|
it "should create new documents with event/doc as upsert" do
|
@@ -134,7 +134,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
134
134
|
subject.register
|
135
135
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
136
136
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
137
|
-
|
137
|
+
expect(r["_source"]["message"]).to eq('sample message here')
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should fail on documents with event/doc as upsert at external version" do
|
@@ -151,7 +151,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
151
151
|
subject.register
|
152
152
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
153
153
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
154
|
-
|
154
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
155
155
|
end
|
156
156
|
|
157
157
|
it "should create new documents with event/doc as script params" do
|
@@ -160,7 +160,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
160
160
|
subject.multi_receive([LogStash::Event.new("counter" => 1)])
|
161
161
|
@es.indices.refresh
|
162
162
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
163
|
-
|
163
|
+
expect(r["_source"]["counter"]).to eq(1)
|
164
164
|
end
|
165
165
|
end
|
166
166
|
end
|
@@ -171,7 +171,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
171
171
|
subject.register
|
172
172
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
173
173
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
174
|
-
|
174
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
175
175
|
end
|
176
176
|
|
177
177
|
it "should create new documents with event/doc as script params" do
|
@@ -180,7 +180,7 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
180
180
|
subject.multi_receive([LogStash::Event.new("counter" => 1)])
|
181
181
|
@es.indices.refresh
|
182
182
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
183
|
-
|
183
|
+
expect(r["_source"]["counter"]).to eq(1)
|
184
184
|
end
|
185
185
|
end
|
186
186
|
end
|
@@ -39,7 +39,7 @@ if ESHelper.es_version_satisfies?("<= 5.x")
|
|
39
39
|
data = response.body
|
40
40
|
result = LogStash::Json.load(data)
|
41
41
|
cur_count = result["count"]
|
42
|
-
|
42
|
+
expect(cur_count).to eq(event_count)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -131,7 +131,7 @@ if ESHelper.es_version_satisfies?(">= 5.6")
|
|
131
131
|
data = response.body
|
132
132
|
result = LogStash::Json.load(data)
|
133
133
|
cur_count = result["count"]
|
134
|
-
|
134
|
+
expect(cur_count).to eq(event_count)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -19,18 +19,17 @@ shared_examples "a routing indexer" do
|
|
19
19
|
it "ships events" do
|
20
20
|
index_url = "http://#{get_host_port()}/#{index}"
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
client = Manticore::Client.new
|
23
|
+
client.post("#{index_url}/_refresh").call
|
24
24
|
|
25
25
|
# Wait until all events are available.
|
26
26
|
Stud::try(10.times) do
|
27
27
|
data = ""
|
28
28
|
|
29
|
-
response =
|
30
|
-
response.
|
31
|
-
result = LogStash::Json.load(data)
|
29
|
+
response = client.get("#{index_url}/_count?q=*&routing=#{routing}").call
|
30
|
+
result = LogStash::Json.load(response.body)
|
32
31
|
cur_count = result["count"]
|
33
|
-
|
32
|
+
expect(cur_count).to eq(event_count)
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -41,44 +41,44 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
41
41
|
# Wait or fail until everything's indexed.
|
42
42
|
Stud::try(20.times) do
|
43
43
|
r = @es.search
|
44
|
-
|
44
|
+
expect(r["hits"]["total"]).to eq(8)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
it "permits phrase searching on string fields" do
|
49
49
|
results = @es.search(:q => "message:\"sample message\"")
|
50
|
-
|
51
|
-
|
50
|
+
expect(results["hits"]["total"]).to eq(1)
|
51
|
+
expect(results["hits"]["hits"][0]["_source"]["message"]).to eq("sample message here")
|
52
52
|
end
|
53
53
|
|
54
54
|
it "numbers dynamically map to a numeric type and permit range queries" do
|
55
55
|
results = @es.search(:q => "somevalue:[5 TO 105]")
|
56
|
-
|
56
|
+
expect(results["hits"]["total"]).to eq(2)
|
57
57
|
|
58
58
|
values = results["hits"]["hits"].collect { |r| r["_source"]["somevalue"] }
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
expect(values).to include(10)
|
60
|
+
expect(values).to include(100)
|
61
|
+
expect(values).to_not include(1)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "does not create .keyword field for top-level message field" do
|
65
65
|
results = @es.search(:q => "message.keyword:\"sample message here\"")
|
66
|
-
|
66
|
+
expect(results["hits"]["total"]).to eq(0)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "creates .keyword field for nested message fields" do
|
70
70
|
results = @es.search(:q => "somemessage.message.keyword:\"sample nested message here\"")
|
71
|
-
|
71
|
+
expect(results["hits"]["total"]).to eq(1)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "creates .keyword field from any string field which is not_analyzed" do
|
75
75
|
results = @es.search(:q => "country.keyword:\"us\"")
|
76
|
-
|
77
|
-
|
76
|
+
expect(results["hits"]["total"]).to eq(1)
|
77
|
+
expect(results["hits"]["hits"][0]["_source"]["country"]).to eq("us")
|
78
78
|
|
79
79
|
# partial or terms should not work.
|
80
80
|
results = @es.search(:q => "country.keyword:\"u\"")
|
81
|
-
|
81
|
+
expect(results["hits"]["total"]).to eq(0)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "make [geoip][location] a geo_point" do
|
@@ -89,10 +89,10 @@ if ESHelper.es_version_satisfies?(">= 5")
|
|
89
89
|
results = @es.search(:body => { "aggregations" => { "my_agg" => { "terms" => { "field" => "country.keyword" } } } })["aggregations"]["my_agg"]
|
90
90
|
terms = results["buckets"].collect { |b| b["key"] }
|
91
91
|
|
92
|
-
|
92
|
+
expect(terms).to include("us")
|
93
93
|
|
94
94
|
# 'at' is a stopword, make sure stopwords are not ignored.
|
95
|
-
|
95
|
+
expect(terms).to include("at")
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -41,44 +41,44 @@ if ESHelper.es_version_satisfies?("< 5")
|
|
41
41
|
# Wait or fail until everything's indexed.
|
42
42
|
Stud::try(20.times) do
|
43
43
|
r = @es.search
|
44
|
-
|
44
|
+
expect(r["hits"]["total"]).to eq(8)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
it "permits phrase searching on string fields" do
|
49
49
|
results = @es.search(:q => "message:\"sample message\"")
|
50
|
-
|
51
|
-
|
50
|
+
expect(results["hits"]["total"]).to eq(1)
|
51
|
+
expect(results["hits"]["hits"][0]["_source"]["message"]).to eq("sample message here")
|
52
52
|
end
|
53
53
|
|
54
54
|
it "numbers dynamically map to a numeric type and permit range queries" do
|
55
55
|
results = @es.search(:q => "somevalue:[5 TO 105]")
|
56
|
-
|
56
|
+
expect(results["hits"]["total"]).to eq(2)
|
57
57
|
|
58
58
|
values = results["hits"]["hits"].collect { |r| r["_source"]["somevalue"] }
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
expect(values).to include(10)
|
60
|
+
expect(values).to include(100)
|
61
|
+
expect(values).to_not include(1)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "does not create .raw field for the message field" do
|
65
65
|
results = @es.search(:q => "message.raw:\"sample message here\"")
|
66
|
-
|
66
|
+
expect(results["hits"]["total"]).to eq(0)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "creates .raw field for nested message fields" do
|
70
70
|
results = @es.search(:q => "somemessage.message.raw:\"sample nested message here\"")
|
71
|
-
|
71
|
+
expect(results["hits"]["total"]).to eq(1)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "creates .raw field from any string field which is not_analyzed" do
|
75
75
|
results = @es.search(:q => "country.raw:\"us\"")
|
76
|
-
|
77
|
-
|
76
|
+
expect(results["hits"]["total"]).to eq(1)
|
77
|
+
expect(results["hits"]["hits"][0]["_source"]["country"]).to eq("us")
|
78
78
|
|
79
79
|
# partial or terms should not work.
|
80
80
|
results = @es.search(:q => "country.raw:\"u\"")
|
81
|
-
|
81
|
+
expect(results["hits"]["total"]).to eq(0)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "make [geoip][location] a geo_point" do
|
@@ -89,10 +89,10 @@ if ESHelper.es_version_satisfies?("< 5")
|
|
89
89
|
results = @es.search(:body => { "aggregations" => { "my_agg" => { "terms" => { "field" => "country.raw" } } } })["aggregations"]["my_agg"]
|
90
90
|
terms = results["buckets"].collect { |b| b["key"] }
|
91
91
|
|
92
|
-
|
92
|
+
expect(terms).to include("us")
|
93
93
|
|
94
94
|
# 'at' is a stopword, make sure stopwords are not ignored.
|
95
|
-
|
95
|
+
expect(terms).to include("at")
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -49,7 +49,7 @@ if ESHelper.es_version_satisfies?(">= 2")
|
|
49
49
|
subject.register
|
50
50
|
subject.multi_receive([LogStash::Event.new("message" => "updated message here")])
|
51
51
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
52
|
-
|
52
|
+
expect(r["_source"]["message"]).to eq('updated message here')
|
53
53
|
end
|
54
54
|
|
55
55
|
# The es ruby client treats the data field differently. Make sure this doesn't
|
@@ -59,8 +59,8 @@ if ESHelper.es_version_satisfies?(">= 2")
|
|
59
59
|
subject.register
|
60
60
|
subject.multi_receive([LogStash::Event.new("data" => "updated message here", "message" => "foo")])
|
61
61
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
|
62
|
-
|
63
|
-
|
62
|
+
expect(r["_source"]["data"]).to eq('updated message here')
|
63
|
+
expect(r["_source"]["message"]).to eq('foo')
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should allow default (internal) version" do
|
@@ -96,7 +96,7 @@ if ESHelper.es_version_satisfies?(">= 2")
|
|
96
96
|
subject.register
|
97
97
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
98
98
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
99
|
-
|
99
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should create new documents with event/doc as upsert" do
|
@@ -104,7 +104,7 @@ if ESHelper.es_version_satisfies?(">= 2")
|
|
104
104
|
subject.register
|
105
105
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
106
106
|
r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
|
107
|
-
|
107
|
+
expect(r["_source"]["message"]).to eq('sample message here')
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should fail on documents with event/doc as upsert at external version" do
|
@@ -8,7 +8,7 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
|
|
8
8
|
opts = {
|
9
9
|
:hosts => [::LogStash::Util::SafeURI.new("127.0.0.1")],
|
10
10
|
:logger => Cabin::Channel.get,
|
11
|
-
:metric => ::LogStash::Instrument::
|
11
|
+
:metric => ::LogStash::Instrument::NullMetric.new(:dummy).namespace(:alsodummy)
|
12
12
|
}
|
13
13
|
|
14
14
|
if !ssl.nil? # Shortcut to set this
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.1.
|
4
|
+
version: 9.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 0.5.4
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
name: manticore
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.5.4
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
requirement: !ruby/object:Gem::Requirement
|
15
35
|
requirements:
|
@@ -64,34 +84,6 @@ dependencies:
|
|
64
84
|
- - "<="
|
65
85
|
- !ruby/object:Gem::Version
|
66
86
|
version: '2.99'
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 0.0.42
|
73
|
-
name: ftw
|
74
|
-
prerelease: false
|
75
|
-
type: :development
|
76
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - "~>"
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: 0.0.42
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
-
requirements:
|
84
|
-
- - "~>"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 2.3.0
|
87
|
-
name: addressable
|
88
|
-
prerelease: false
|
89
|
-
type: :development
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - "~>"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: 2.3.0
|
95
87
|
- !ruby/object:Gem::Dependency
|
96
88
|
requirement: !ruby/object:Gem::Requirement
|
97
89
|
requirements:
|
@@ -106,54 +98,6 @@ dependencies:
|
|
106
98
|
- - ">="
|
107
99
|
- !ruby/object:Gem::Version
|
108
100
|
version: '0'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
requirement: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: '0'
|
115
|
-
name: json
|
116
|
-
prerelease: false
|
117
|
-
type: :development
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '0'
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
requirement: !ruby/object:Gem::Requirement
|
125
|
-
requirements:
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: '0'
|
129
|
-
name: gzip
|
130
|
-
prerelease: false
|
131
|
-
type: :development
|
132
|
-
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - ">="
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '0'
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
requirement: !ruby/object:Gem::Requirement
|
139
|
-
requirements:
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: 0.5.4
|
143
|
-
- - "<"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 1.0.0
|
146
|
-
name: manticore
|
147
|
-
prerelease: false
|
148
|
-
type: :runtime
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: 0.5.4
|
154
|
-
- - "<"
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version: 1.0.0
|
157
101
|
- !ruby/object:Gem::Dependency
|
158
102
|
requirement: !ruby/object:Gem::Requirement
|
159
103
|
requirements:
|
@@ -286,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
230
|
version: '0'
|
287
231
|
requirements: []
|
288
232
|
rubyforge_project:
|
289
|
-
rubygems_version: 2.6.
|
233
|
+
rubygems_version: 2.6.13
|
290
234
|
signing_key:
|
291
235
|
specification_version: 4
|
292
236
|
summary: Stores logs in Elasticsearch
|