logstash-output-elastic_app_search 1.0.0.beta1 → 1.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 +4 -0
- data/CONTRIBUTORS +1 -0
- data/lib/logstash-output-elastic_app_search_jars.rb +1 -1
- data/lib/logstash/outputs/elastic_app_search.rb +23 -3
- data/logstash-output-elastic_app_search.gemspec +2 -2
- data/spec/outputs/appsearch_spec.rb +31 -1
- data/vendor/{swiftype-app-search-0.3.0-all.jar → swiftype-app-search-0.4.1-all.jar} +0 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb2ae52ad36bc6b5ebb7234c062f49aaf31f55e9be0da33b3c653307dd385cb
|
4
|
+
data.tar.gz: 6bb21f904b708bb76b52ffb9cb857655e149b78db2f6057aea18dcab062fcb33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 498ee5a0621c2b42b5fb781daf75561f5c289333092c64f9a6563f8e419c9ce6143ff737b9bd3143923946c73e164b9192b338bc4f5bcdd30ff9ef2bb5666957
|
7
|
+
data.tar.gz: ef8154b9cf148657a72f8baaad838bb66bf56c89cc5ef369ea3b7ceffdd3a7da18768ccdbeea4a90b5f0f597af178731c59920373ba96292e7808111811e929d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.0.0
|
2
|
+
- Added support for On Premise installations of Elastic App Search
|
3
|
+
- Updated java client to 0.4.1
|
4
|
+
|
1
5
|
## 1.0.0.beta1
|
2
6
|
- Changed documentation to correct required fields and other information [#2](https://github.com/logstash-plugins/logstash-output-elastic_app_search/pull/2)
|
3
7
|
- Added check for correct host, engine and api_key during register [#2](https://github.com/logstash-plugins/logstash-output-elastic_app_search/pull/2)
|
data/CONTRIBUTORS
CHANGED
@@ -3,6 +3,7 @@ reports, or in general have helped logstash along its way.
|
|
3
3
|
|
4
4
|
Contributors:
|
5
5
|
* Joao Duarte - jsvduarte@gmail.com
|
6
|
+
* Peter Kim - petedogg@gmail.com
|
6
7
|
|
7
8
|
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
8
9
|
Logstash, and you aren't on the list above and want to be, please let us know
|
@@ -1 +1 @@
|
|
1
|
-
require_relative '../vendor/swiftype-app-search-0.
|
1
|
+
require_relative '../vendor/swiftype-app-search-0.4.1-all.jar'
|
@@ -7,15 +7,27 @@ class LogStash::Outputs::ElasticAppSearch < LogStash::Outputs::Base
|
|
7
7
|
config_name "elastic_app_search"
|
8
8
|
|
9
9
|
config :engine, :validate => :string, :required => true
|
10
|
-
config :host, :validate => :string
|
10
|
+
config :host, :validate => :string
|
11
|
+
config :url, :validate => :string
|
11
12
|
config :api_key, :validate => :password, :required => true
|
12
13
|
config :timestamp_destination, :validate => :string
|
13
14
|
config :document_id, :validate => :string
|
15
|
+
config :path, :validate => :string, :default => "/api/as/v1/"
|
14
16
|
|
15
17
|
public
|
16
18
|
def register
|
17
|
-
|
18
|
-
|
19
|
+
if @host.nil? && @url.nil?
|
20
|
+
raise ::LogStash::ConfigurationError.new("Please specify either \"url\" (for self-managed) or \"host\" (for SaaS).")
|
21
|
+
elsif @host && @url
|
22
|
+
raise ::LogStash::ConfigurationError.new("Both \"url\" or \"host\" can't be set simultaneously. Please specify either \"url\" (for self-managed) or \"host\" (for SaaS).")
|
23
|
+
elsif @host && path_is_set? # because path has a default value we need extra work to if the user set it
|
24
|
+
raise ::LogStash::ConfigurationError.new("The setting \"path\" is not compatible with \"host\". Use \"path\" only with \"url\".")
|
25
|
+
elsif @host
|
26
|
+
@client = Client.new(@host, @api_key.value)
|
27
|
+
elsif @url
|
28
|
+
@client = Client.new(nil, @api_key.value, @url + @path)
|
29
|
+
end
|
30
|
+
check_connection!
|
19
31
|
rescue => e
|
20
32
|
if e.message =~ /401/
|
21
33
|
raise ::LogStash::ConfigurationError.new("Failed to connect to App Search. Error: 401. Please check your credentials")
|
@@ -76,4 +88,12 @@ class LogStash::Outputs::ElasticAppSearch < LogStash::Outputs::Base
|
|
76
88
|
end
|
77
89
|
end
|
78
90
|
end
|
91
|
+
|
92
|
+
def check_connection!
|
93
|
+
@client.get_engine(@engine)
|
94
|
+
end
|
95
|
+
|
96
|
+
def path_is_set?
|
97
|
+
original_params.key?("path")
|
98
|
+
end
|
79
99
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elastic_app_search'
|
3
|
-
s.version = '1.0.0
|
3
|
+
s.version = '1.0.0'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Index data to Elastic App Search'
|
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'
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
# Special flag to let us know this is actually a logstash plugin
|
18
18
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
19
19
|
|
20
|
-
s.add_development_dependency 'jar-dependencies', '~> 0.
|
20
|
+
s.add_development_dependency 'jar-dependencies', '~> 0.4'
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
23
|
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
@@ -9,5 +9,35 @@ describe LogStash::Outputs::ElasticAppSearch do
|
|
9
9
|
let(:host) { "test-host" }
|
10
10
|
let(:api_key) { "my_key" }
|
11
11
|
let(:engine) { "test-engine" }
|
12
|
-
|
12
|
+
subject { described_class.new(config) }
|
13
|
+
|
14
|
+
describe "#register" do
|
15
|
+
before(:each) do
|
16
|
+
allow(subject).to receive(:check_connection!)
|
17
|
+
end
|
18
|
+
context "when host is configured" do
|
19
|
+
let(:config) { { "host" => host, "api_key" => api_key, "engine" => engine } }
|
20
|
+
it "does not raise an error" do
|
21
|
+
expect { subject.register }.to_not raise_error
|
22
|
+
end
|
23
|
+
end
|
24
|
+
context "when host and path is configured" do
|
25
|
+
let(:config) { { "host" => host, "api_key" => api_key, "engine" => engine, "path" => "/v1" } }
|
26
|
+
it "raises an error" do
|
27
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
context "when host and url is configured" do
|
31
|
+
let(:config) { { "host" => host, "api_key" => api_key, "engine" => engine, "url" => "http://localhost:9300" } }
|
32
|
+
it "raises an error" do
|
33
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
context "when neither host nor url is configured" do
|
37
|
+
let(:config) { { "api_key" => api_key, "engine" => engine } }
|
38
|
+
it "raises an error" do
|
39
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
13
43
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elastic_app_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joao Duarte
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.4'
|
20
20
|
name: jar-dependencies
|
21
21
|
prerelease: false
|
22
22
|
type: :development
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: '0.4'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- lib/logstash/outputs/elastic_app_search.rb
|
86
86
|
- logstash-output-elastic_app_search.gemspec
|
87
87
|
- spec/outputs/appsearch_spec.rb
|
88
|
-
- vendor/swiftype-app-search-0.
|
88
|
+
- vendor/swiftype-app-search-0.4.1-all.jar
|
89
89
|
homepage: https://elastic.co
|
90
90
|
licenses:
|
91
91
|
- Apache-2.0
|
@@ -103,9 +103,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- - "
|
106
|
+
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
111
|
rubygems_version: 2.6.13
|