logstash-output-amazon_es 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/lib/logstash/outputs/amazon_es.rb +25 -22
- data/lib/logstash/outputs/amazon_es/http_client.rb +3 -2
- data/logstash-output-amazon_es.gemspec +1 -1
- 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: 91df4bac9097a2019a5ff1d37a7bf34ed1e868e3
|
4
|
+
data.tar.gz: 0966b9abe9df86ab821c223a636c20e0a5ba4131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1394030e59655508565ad916c1a4b2cf63db64a688f709d04fd243cc66ca90474c870a6331971b9eff2278c9ac5a38e7e2a6f0125718a67b08e15ccc5aee2d
|
7
|
+
data.tar.gz: 0c88842929c77097e10bb0eaa8d8cd07efbf3e7c391faa4436cfb93fca4526e1deaf06b8b918ecf11d363085d198581c7dcacd0bf1d08cbeefcdd8a4836778b2
|
data/README.md
CHANGED
@@ -10,12 +10,12 @@ It is fully free and fully open source. The license is Apache 2.0, meaning you a
|
|
10
10
|
One command installation
|
11
11
|
`bin/plugin install logstash-output-amazon_es`
|
12
12
|
|
13
|
-
While we are in the process of getting this plugin fully integrated within logstash to make installation simpler,
|
13
|
+
While we are in the process of getting this plugin fully integrated within logstash to make installation simpler,
|
14
14
|
if above does not work, or you would like to patch code here is a workaround to install this plugin within your logstash:
|
15
15
|
|
16
16
|
1. Check out/clone this code from github
|
17
17
|
2. Build plugin using - `gem build logstash-output-amazon_es.gemspec` ( this works with jruby and rubygem versions > 1.9)
|
18
|
-
3. Install plugin using `<logstash-home>/bin/plugin install logstash-output-amazon_es-0.
|
18
|
+
3. Install plugin using `<logstash-home>/bin/plugin install logstash-output-amazon_es-0.2.0-java.gem` (or the non java variant)
|
19
19
|
|
20
20
|
## Configuration for Amazon Elasticsearch Output plugin
|
21
21
|
|
@@ -28,15 +28,15 @@ An example configuration:
|
|
28
28
|
hosts => ["foo.us-east-1.es.amazonaws.com"]
|
29
29
|
region => "us-east-1"
|
30
30
|
aws_access_key_id => 'ACCESS_KEY' (Will be made optional in next release to support instance profiles)
|
31
|
-
aws_secret_access_key => 'SECRET_KEY'
|
31
|
+
aws_secret_access_key => 'SECRET_KEY'
|
32
32
|
index => "production-logs-%{+YYYY.MM.dd}"
|
33
33
|
}
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
* Required Parameters
|
37
37
|
* hosts (array of string) - Amazon Elasticsearch domain endpoint. eg ["foo.us-east-1.es.amazonaws.com"]
|
38
38
|
* region (string, :default => "us-east-1") - region where the domain is located
|
39
|
-
|
39
|
+
|
40
40
|
* Optional Parameters
|
41
41
|
* Credential parameters
|
42
42
|
* aws_access_key_id, :validate => :string - Optional AWS Access key
|
@@ -62,7 +62,8 @@ An example configuration:
|
|
62
62
|
This helps keep both fast and slow log streams moving along in near-real-time.
|
63
63
|
* template (path) - You can set the path to your own template here, if you so desire. If not set, the included template will be used.
|
64
64
|
* template_name (string, default => "logstash") - defines how the template is named inside Elasticsearch
|
65
|
-
* port (string, default
|
65
|
+
* port (string, default 443) - Amazon Elasticsearch Service listens on port 443 - https (default) and 80 - http. Tweak this for custom proxy.
|
66
|
+
* protocol (string, default https) - The protocol used to connect to the Amazon Elasticsearch Service
|
66
67
|
|
67
68
|
## Documentation
|
68
69
|
|
@@ -108,7 +109,7 @@ bundle exec rspec
|
|
108
109
|
Dependencies: [Docker](http://docker.com)
|
109
110
|
|
110
111
|
Before the test suite is run, we will load and run an
|
111
|
-
Elasticsearch instance within a docker container. This container
|
112
|
+
Elasticsearch instance within a docker container. This container
|
112
113
|
will be cleaned up when suite has finished.
|
113
114
|
|
114
115
|
```sh
|
@@ -14,11 +14,11 @@ require "uri"
|
|
14
14
|
#
|
15
15
|
#
|
16
16
|
# The configuration and experience is similar to logstash-output-elasticsearch plugin and we have added Signature V4 support for the same
|
17
|
-
# Some of the default configurations like connection timeouts have been tuned for optimal performance with Amazon Elasticsearch
|
17
|
+
# Some of the default configurations like connection timeouts have been tuned for optimal performance with Amazon Elasticsearch
|
18
18
|
#
|
19
19
|
# ==== Retry Policy
|
20
20
|
#
|
21
|
-
# This plugin uses the same retry policy as logstash-output-elasticsearch, It uses bulk API to optimize its
|
21
|
+
# This plugin uses the same retry policy as logstash-output-elasticsearch, It uses bulk API to optimize its
|
22
22
|
# imports into Elasticsearch.. These requests may experience either partial or total failures.
|
23
23
|
# Events are retried if they fail due to either a network error or the status codes
|
24
24
|
# 429 (the server is busy), 409 (Version Conflict), or 503 (temporary overloading/maintenance).
|
@@ -53,13 +53,13 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
53
53
|
|
54
54
|
# The index type to write events to. Generally you should try to write only
|
55
55
|
# similar events to the same 'type'. String expansion `%{foo}` works here.
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# Deprecated in favor of `document_type` field.
|
58
58
|
config :index_type, :validate => :string, :deprecated => "Please use the 'document_type' setting instead. It has the same effect, but is more appropriately named."
|
59
59
|
|
60
60
|
# The document type to write events to. Generally you should try to write only
|
61
61
|
# similar events to the same 'type'. String expansion `%{foo}` works here.
|
62
|
-
# Unless you set 'document_type', the event 'type' will be used if it exists
|
62
|
+
# Unless you set 'document_type', the event 'type' will be used if it exists
|
63
63
|
# otherwise the document type will be assigned the value of 'logs'
|
64
64
|
config :document_type, :validate => :string
|
65
65
|
|
@@ -100,28 +100,31 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
100
100
|
config :routing, :validate => :string
|
101
101
|
|
102
102
|
|
103
|
-
# Set the endpoint of your Amazon Elasticsearch domain. This will always be array of size 1
|
103
|
+
# Set the endpoint of your Amazon Elasticsearch domain. This will always be array of size 1
|
104
104
|
# ["foo.us-east-1.es.amazonaws.com"]
|
105
105
|
config :hosts, :validate => :array
|
106
106
|
|
107
107
|
# You can set the remote port as part of the host, or explicitly here as well
|
108
|
-
config :port, :validate => :string, :default =>
|
109
|
-
|
108
|
+
config :port, :validate => :string, :default => 443
|
109
|
+
|
110
|
+
# Sets the protocol thats used to connect to elastisearch
|
111
|
+
config :protocol, :validate => :string, :default => "https"
|
112
|
+
|
110
113
|
#Signing specific details
|
111
114
|
config :region, :validate => :string, :default => "us-east-1"
|
112
|
-
|
113
|
-
# aws_access_key_id and aws_secret_access_key are currently needed for this plugin to work right.
|
115
|
+
|
116
|
+
# aws_access_key_id and aws_secret_access_key are currently needed for this plugin to work right.
|
114
117
|
# Subsequent versions will have the credential resolution logic as follows:
|
115
118
|
#
|
116
|
-
# - User passed aws_access_key_id and aws_secret_access_key in aes configuration
|
117
|
-
# - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
|
118
|
-
# (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET),
|
119
|
+
# - User passed aws_access_key_id and aws_secret_access_key in aes configuration
|
120
|
+
# - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
|
121
|
+
# (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET),
|
119
122
|
# or AWS_ACCESS_KEY and AWS_SECRET_KEY (only recognized by Java SDK)
|
120
123
|
# - Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
|
121
124
|
# - Instance profile credentials delivered through the Amazon EC2 metadata service
|
122
125
|
config :aws_access_key_id, :validate => :string
|
123
126
|
config :aws_secret_access_key, :validate => :string
|
124
|
-
|
127
|
+
|
125
128
|
|
126
129
|
# This plugin uses the bulk index api for improved indexing performance.
|
127
130
|
# To make efficient bulk api calls, we will buffer a certain number of
|
@@ -224,7 +227,7 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
224
227
|
common_options.merge! update_options if @action == 'update'
|
225
228
|
|
226
229
|
@client = LogStash::Outputs::AES::HttpClient.new(
|
227
|
-
common_options.merge(:hosts => @hosts, :port => @port, :region => @region, :aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key)
|
230
|
+
common_options.merge(:hosts => @hosts, :port => @port, :region => @region, :aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key,:protocol => @protocol)
|
228
231
|
)
|
229
232
|
|
230
233
|
if @manage_template
|
@@ -279,7 +282,7 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
279
282
|
def receive(event)
|
280
283
|
return unless output?(event)
|
281
284
|
|
282
|
-
# block until we have not maxed out our
|
285
|
+
# block until we have not maxed out our
|
283
286
|
# retry queue. This is applying back-pressure
|
284
287
|
# to slow down the receive-rate
|
285
288
|
@retry_flush_mutex.synchronize {
|
@@ -303,7 +306,7 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
303
306
|
:_type => type,
|
304
307
|
:_routing => @routing ? event.sprintf(@routing) : nil
|
305
308
|
}
|
306
|
-
|
309
|
+
|
307
310
|
params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @action == 'update' && @upsert != ""
|
308
311
|
|
309
312
|
buffer_receive([event.sprintf(@action), params, event])
|
@@ -380,19 +383,19 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
380
383
|
|
381
384
|
@retry_teardown_requested.make_true
|
382
385
|
# First, make sure retry_timer_thread is stopped
|
383
|
-
# to ensure we do not signal a retry based on
|
386
|
+
# to ensure we do not signal a retry based on
|
384
387
|
# the retry interval.
|
385
388
|
Thread.kill(@retry_timer_thread)
|
386
389
|
@retry_timer_thread.join
|
387
|
-
# Signal flushing in the case that #retry_flush is in
|
390
|
+
# Signal flushing in the case that #retry_flush is in
|
388
391
|
# the process of waiting for a signal.
|
389
392
|
@retry_flush_mutex.synchronize { @retry_queue_needs_flushing.signal }
|
390
|
-
# Now, #retry_flush is ensured to not be in a state of
|
393
|
+
# Now, #retry_flush is ensured to not be in a state of
|
391
394
|
# waiting and can be safely joined into the main thread
|
392
395
|
# for further final execution of an in-process remaining call.
|
393
396
|
@retry_thread.join
|
394
397
|
|
395
|
-
# execute any final actions along with a proceeding retry for any
|
398
|
+
# execute any final actions along with a proceeding retry for any
|
396
399
|
# final actions that did not succeed.
|
397
400
|
buffer_flush(:final => true)
|
398
401
|
retry_flush
|
@@ -426,11 +429,11 @@ class LogStash::Outputs::AmazonES < LogStash::Outputs::Base
|
|
426
429
|
|
427
430
|
|
428
431
|
private
|
429
|
-
# in charge of submitting any actions in @retry_queue that need to be
|
432
|
+
# in charge of submitting any actions in @retry_queue that need to be
|
430
433
|
# retried
|
431
434
|
#
|
432
435
|
# This method is not called concurrently. It is only called by @retry_thread
|
433
|
-
# and once that thread is ended during the teardown process, a final call
|
436
|
+
# and once that thread is ended during the teardown process, a final call
|
434
437
|
# to this method is done upon teardown in the main thread.
|
435
438
|
def retry_flush()
|
436
439
|
unless @retry_queue.empty?
|
@@ -59,10 +59,11 @@ module LogStash::Outputs::AES
|
|
59
59
|
def build_client(options)
|
60
60
|
hosts = options[:hosts]
|
61
61
|
port = options[:port]
|
62
|
+
protocol = options[:protocol]
|
62
63
|
client_settings = options[:client_settings] || {}
|
63
64
|
|
64
65
|
uris = hosts.map do |host|
|
65
|
-
"
|
66
|
+
"#{protocol}://#{host}:#{port}#{client_settings[:path]}".gsub(/[\/]+$/,'')
|
66
67
|
end
|
67
68
|
|
68
69
|
@client_options = {
|
@@ -72,7 +73,7 @@ module LogStash::Outputs::AES
|
|
72
73
|
:aws_secret_access_key => options[:aws_secret_access_key],
|
73
74
|
:transport_options => {
|
74
75
|
:request => {:open_timeout => 0, :timeout => 60}, # ELB timeouts are set at 60
|
75
|
-
:proxy => client_settings[:proxy],
|
76
|
+
:proxy => client_settings[:proxy],
|
76
77
|
},
|
77
78
|
:transport_class => Elasticsearch::Transport::Transport::HTTP::AWS
|
78
79
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-amazon_es'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '0.2.0'
|
5
5
|
s.licenses = ['apache-2.0']
|
6
6
|
s.summary = "Logstash Output to Amazon Elasticsearch Service"
|
7
7
|
s.description = "Output events to Amazon Elasticsearch Service with V4 signing"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-amazon_es
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|