Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,16 @@ fields => {

List of elasticsearch hosts to use for querying.

This option can accept an environment variable containing one or more hostnames separated by whitespace.
Strings separated by whitespace are treated as separate entries.

*Examples:*

* `ES_HOSTS="es1.example.com es2.example.com:9201 es3.example.com:9201"`
* `ES_HOSTS="127.0.0.1:9200 127.0.0.2:9200"`
* `ES_HOSTS="http://127.0.0.1 http://127.0.0.2"`
* `ES_HOSTS="https://127.0.0.1:9200/mypath https://127.0.0.2:9200/mypath"`

[id="plugins-{type}s-{plugin}-index"]
===== `index`

Expand Down
22 changes: 11 additions & 11 deletions spec/filters/elasticsearch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
'sample:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2OjkyNDMkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA6OTI0NA=='
end

let(:config) { super.merge({ 'cloud_id' => valid_cloud_id }) }
let(:config) { super().merge({ 'cloud_id' => valid_cloud_id }) }

it "should set host(s)" do
plugin.register
Expand All @@ -328,15 +328,15 @@
end

context 'invalid' do
let(:config) { super.merge({ 'cloud_id' => 'invalid:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlv' }) }
let(:config) { super().merge({ 'cloud_id' => 'invalid:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlv' }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_id.*? is invalid/
end
end

context 'hosts also set' do
let(:config) { super.merge({ 'cloud_id' => valid_cloud_id, 'hosts' => [ 'localhost:9200' ] }) }
let(:config) { super().merge({ 'cloud_id' => valid_cloud_id, 'hosts' => [ 'localhost:9200' ] }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_id and hosts/
Expand All @@ -345,7 +345,7 @@
end if LOGSTASH_VERSION > '6.0'

describe "cloud.auth" do
let(:config) { super.merge({ 'cloud_auth' => LogStash::Util::Password.new('elastic:my-passwd-00') }) }
let(:config) { super().merge({ 'cloud_auth' => LogStash::Util::Password.new('elastic:my-passwd-00') }) }

it "should set authorization" do
plugin.register
Expand All @@ -356,15 +356,15 @@
end

context 'invalid' do
let(:config) { super.merge({ 'cloud_auth' => 'invalid-format' }) }
let(:config) { super().merge({ 'cloud_auth' => 'invalid-format' }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_auth.*? format/
end
end

context 'user also set' do
let(:config) { super.merge({ 'cloud_auth' => 'elastic:my-passwd-00', 'user' => 'another' }) }
let(:config) { super().merge({ 'cloud_auth' => 'elastic:my-passwd-00', 'user' => 'another' }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Multiple authentication options are specified/
Expand All @@ -374,15 +374,15 @@

describe "api_key" do
context "without ssl" do
let(:config) { super.merge({ 'api_key' => LogStash::Util::Password.new('foo:bar') }) }
let(:config) { super().merge({ 'api_key' => LogStash::Util::Password.new('foo:bar') }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /api_key authentication requires SSL\/TLS/
end
end

context "with ssl" do
let(:config) { super.merge({ 'api_key' => LogStash::Util::Password.new('foo:bar'), "ssl" => true }) }
let(:config) { super().merge({ 'api_key' => LogStash::Util::Password.new('foo:bar'), "ssl" => true }) }

it "should set authorization" do
plugin.register
Expand All @@ -393,7 +393,7 @@
end

context 'user also set' do
let(:config) { super.merge({ 'api_key' => 'foo:bar', 'user' => 'another' }) }
let(:config) { super().merge({ 'api_key' => 'foo:bar', 'user' => 'another' }) }

it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Multiple authentication options are specified/
Expand All @@ -404,7 +404,7 @@

describe "proxy" do
context 'valid' do
let(:config) { super.merge({ 'proxy' => 'http://localhost:1234' }) }
let(:config) { super().merge({ 'proxy' => 'http://localhost:1234' }) }

it "should set proxy" do
plugin.register
Expand All @@ -416,7 +416,7 @@
end

context 'invalid' do
let(:config) { super.merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }
let(:config) { super().merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }

it "should not set proxy" do
plugin.register
Expand Down