logstash-output-elasticsearch 2.5.1-java → 2.5.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 +7 -0
- data/CONTRIBUTORS +1 -0
- data/lib/logstash/outputs/elasticsearch/common.rb +6 -5
- data/lib/logstash/outputs/elasticsearch/http_client.rb +4 -1
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/integration/outputs/update_spec.rb +32 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d828f1e289c77ea6baff44c741445806d2269d57
|
4
|
+
data.tar.gz: a2dd7280157da88097c32701db5a394748de4378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0590f8743db7c23025c4816d82f0d32d1f053b6a4f2aae8204c9cbbc2a43277ba082f3dc89cbeb92215ce3c63d897c985177c2124baff41e25ffee04f250584f
|
7
|
+
data.tar.gz: e9522c843c2a8d89b7187ec43f9e64e5c309114c13a2af4b6164518f702594e713a10f0bdcfa10e5b4d42bea8fb153ad3f976c0924a4f14007685a0c2e4655b0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 2.5.3
|
2
|
+
- Fix bug with update document with doc_as_upsert and scripting (#364, #359)
|
3
|
+
- Make error messages more verbose and easier to parse by humans
|
4
|
+
|
5
|
+
## 2.5.2
|
6
|
+
- Retryable failures are now logged at the info level instead of warning. (issue #372)
|
7
|
+
|
1
8
|
## 2.5.1
|
2
9
|
- Fix bug where SSL would sometimes not be enabled
|
3
10
|
|
data/CONTRIBUTORS
CHANGED
@@ -107,12 +107,13 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
107
107
|
bulk_response["items"].each_with_index do |response,idx|
|
108
108
|
action_type, action_props = response.first
|
109
109
|
status = action_props["status"]
|
110
|
+
error = action_props["error"]
|
110
111
|
action = actions[idx]
|
111
112
|
|
112
113
|
if SUCCESS_CODES.include?(status)
|
113
114
|
next
|
114
115
|
elsif RETRYABLE_CODES.include?(status)
|
115
|
-
@logger.
|
116
|
+
@logger.info "retrying failed action with response code: #{status} (#{error})"
|
116
117
|
actions_to_retry << action
|
117
118
|
else
|
118
119
|
@logger.warn "Failed action. ", status: status, action: action, response: response
|
@@ -166,9 +167,9 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
166
167
|
@logger.error(
|
167
168
|
"Attempted to send a bulk request to Elasticsearch configured at '#{@client.client_options[:hosts]}',"+
|
168
169
|
" but Elasticsearch appears to be unreachable or down!",
|
169
|
-
:client_config => @client.client_options,
|
170
170
|
:error_message => e.message,
|
171
|
-
:class => e.class.name
|
171
|
+
:class => e.class.name,
|
172
|
+
:client_config => @client.client_options,
|
172
173
|
)
|
173
174
|
@logger.debug("Failed actions for last bad bulk request!", :actions => actions)
|
174
175
|
|
@@ -181,10 +182,10 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
181
182
|
"Attempted to send a bulk request to Elasticsearch configured at '#{@client.client_options[:hosts]}'," +
|
182
183
|
" but an error occurred and it failed! Are you sure you can reach elasticsearch from this machine using " +
|
183
184
|
"the configuration provided?",
|
184
|
-
:client_config => @client.client_options,
|
185
185
|
:error_message => e.message,
|
186
186
|
:error_class => e.class.name,
|
187
|
-
:backtrace => e.backtrace
|
187
|
+
:backtrace => e.backtrace,
|
188
|
+
:client_config => @client.client_options,
|
188
189
|
)
|
189
190
|
|
190
191
|
@logger.debug("Failed actions for last bad bulk request!", :actions => actions)
|
@@ -203,10 +203,13 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
203
203
|
# Use the event as a hash from your script with variable name defined
|
204
204
|
# by script_var_name (default: "event")
|
205
205
|
# Ex: event["@timestamp"]
|
206
|
-
|
206
|
+
source_orig = source
|
207
|
+
source = { 'script' => {'params' => { @options[:script_var_name] => source_orig }} }
|
207
208
|
if @options[:scripted_upsert]
|
208
209
|
source['scripted_upsert'] = true
|
209
210
|
source['upsert'] = {}
|
211
|
+
elsif @options[:doc_as_upsert]
|
212
|
+
source['upsert'] = source_orig
|
210
213
|
else
|
211
214
|
source['upsert'] = args.delete(:_upsert) if args[:_upsert]
|
212
215
|
end
|
@@ -77,17 +77,47 @@ describe "Update actions", :integration => true do
|
|
77
77
|
it "should increment a counter with event/doc 'count' variable with inline script" do
|
78
78
|
subject = get_es_output({
|
79
79
|
'document_id' => "123",
|
80
|
-
'script' => 'ctx._source.counter += event["
|
80
|
+
'script' => 'ctx._source.counter += event["counter"]',
|
81
81
|
'script_lang' => 'groovy',
|
82
82
|
'script_type' => 'inline'
|
83
83
|
})
|
84
84
|
subject.register
|
85
|
-
subject.receive(LogStash::Event.new("
|
85
|
+
subject.receive(LogStash::Event.new("counter" => 3 ))
|
86
86
|
subject.flush
|
87
87
|
r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "123", :refresh => true)
|
88
88
|
insist { r["_source"]["counter"] } == 4
|
89
89
|
end
|
90
90
|
|
91
|
+
it "should increment a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
92
|
+
subject = get_es_output({
|
93
|
+
'document_id' => "123",
|
94
|
+
'doc_as_upsert' => true,
|
95
|
+
'script' => 'if( ctx._source.containsKey("counter") ){ ctx._source.counter += event["counter"]; } else { ctx._source.counter = event["counter"]; }',
|
96
|
+
'script_lang' => 'groovy',
|
97
|
+
'script_type' => 'inline'
|
98
|
+
})
|
99
|
+
subject.register
|
100
|
+
subject.receive(LogStash::Event.new("counter" => 3 ))
|
101
|
+
subject.flush
|
102
|
+
r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "123", :refresh => true)
|
103
|
+
insist { r["_source"]["counter"] } == 4
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should, with new doc, set a counter with event/doc 'count' variable with event/doc as upsert and inline script" do
|
107
|
+
subject = get_es_output({
|
108
|
+
'document_id' => "456",
|
109
|
+
'doc_as_upsert' => true,
|
110
|
+
'script' => 'if( ctx._source.containsKey("counter") ){ ctx._source.counter += event["count"]; } else { ctx._source.counter = event["count"]; }',
|
111
|
+
'script_lang' => 'groovy',
|
112
|
+
'script_type' => 'inline'
|
113
|
+
})
|
114
|
+
subject.register
|
115
|
+
subject.receive(LogStash::Event.new("counter" => 3 ))
|
116
|
+
subject.flush
|
117
|
+
r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
|
118
|
+
insist { r["_source"]["counter"] } == 3
|
119
|
+
end
|
120
|
+
|
91
121
|
it "should increment a counter with event/doc 'count' variable with indexed script" do
|
92
122
|
@es.put_script lang: 'groovy', id: 'indexed_update', body: { script: 'ctx._source.counter += event["count"]' }
|
93
123
|
subject = get_es_output({
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|