Skip to content

Commit

Permalink
rename config option .url and .ca to .hosts and .certificate_authority (
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant authored Feb 5, 2019
1 parent e262d6b commit 6990d08
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 47 deletions.
8 changes: 4 additions & 4 deletions config/logstash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@
#xpack.monitoring.enabled: false
#xpack.monitoring.elasticsearch.username: logstash_system
#xpack.monitoring.elasticsearch.password: password
#xpack.monitoring.elasticsearch.url: ["https://es1:9200", "https://es2:9200"]
#xpack.monitoring.elasticsearch.ssl.ca: [ "/path/to/ca.crt" ]
#xpack.monitoring.elasticsearch.hosts: ["https://es1:9200", "https://es2:9200"]
#xpack.monitoring.elasticsearch.ssl.certificate_authority: [ "/path/to/ca.crt" ]
#xpack.monitoring.elasticsearch.ssl.truststore.path: path/to/file
#xpack.monitoring.elasticsearch.ssl.truststore.password: password
#xpack.monitoring.elasticsearch.ssl.keystore.path: /path/to/file
Expand All @@ -236,8 +236,8 @@
#xpack.management.pipeline.id: ["main", "apache_logs"]
#xpack.management.elasticsearch.username: logstash_admin_user
#xpack.management.elasticsearch.password: password
#xpack.management.elasticsearch.url: ["https://es1:9200", "https://es2:9200"]
#xpack.management.elasticsearch.ssl.ca: [ "/path/to/ca.crt" ]
#xpack.management.elasticsearch.hosts: ["https://es1:9200", "https://es2:9200"]
#xpack.management.elasticsearch.ssl.certificate_authority: [ "/path/to/ca.crt" ]
#xpack.management.elasticsearch.ssl.truststore.path: /path/to/file
#xpack.management.elasticsearch.ssl.truststore.password: password
#xpack.management.elasticsearch.ssl.keystore.path: /path/to/file
Expand Down
4 changes: 2 additions & 2 deletions docs/static/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ images:

[horizontal]
`http.host`:: `0.0.0.0`
`xpack.monitoring.elasticsearch.url`:: `http://elasticsearch:9200`
`xpack.monitoring.elasticsearch.hosts`:: `http://elasticsearch:9200`

NOTE: The setting `xpack.monitoring.elasticsearch.url` is not
NOTE: The setting `xpack.monitoring.elasticsearch.hosts` is not
defined in the `-oss` image.

These settings are defined in the default `logstash.yml`. They can be overridden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ minimum, set:
+
* `xpack.management.enabled: true` to enable centralized configuration
management.
* `xpack.management.elasticsearch.url` to specify the Elasticsearch
* `xpack.management.elasticsearch.hosts` to specify the Elasticsearch
instance that will store the Logstash pipeline configurations and metadata.
* `xpack.management.pipeline.id` to register the pipelines that you want to
centrally manage.
Expand Down
8 changes: 4 additions & 4 deletions docs/static/monitoring/configuring-logstash.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ production cluster. If that setting is `false`, the collection of monitoring dat
is disabled in {es} and data is ignored from all other sources.

. Configure your Logstash nodes to send metrics by setting the
`xpack.monitoring.elasticsearch.url` in `logstash.yml`. If {security} is enabled,
`xpack.monitoring.elasticsearch.hosts` in `logstash.yml`. If {security} is enabled,
you also need to specify the credentials for the
{stack-ov}/built-in-users.html[built-in `logstash_system` user]. For more information about these settings, see <<monitoring-settings>>.
+
--
[source,yaml]
--------------------------------------------------
xpack.monitoring.elasticsearch.url: ["http://es-prod-node-1:9200", "http://es-prod-node-2:9200"] <1>
xpack.monitoring.elasticsearch.hosts: ["http://es-prod-node-1:9200", "http://es-prod-node-2:9200"] <1>
xpack.monitoring.elasticsearch.username: "logstash_system" <2>
xpack.monitoring.elasticsearch.password: "changeme"
--------------------------------------------------
Expand All @@ -50,11 +50,11 @@ in the cluster.
--
To add a CA certificate to a Logstash node's trusted certificates, you
can specify the location of the PEM encoded certificate with the
`ca` setting:
`certificate_authority` setting:

[source,yaml]
--------------------------------------------------
xpack.monitoring.elasticsearch.ssl.ca: /path/to/ca.crt
xpack.monitoring.elasticsearch.ssl.certificate_authority: /path/to/ca.crt
--------------------------------------------------

Alternatively, you can configure trusted certificates using a truststore
Expand Down
4 changes: 2 additions & 2 deletions docs/static/monitoring/monitoring-output.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ the following default configuration is used:

[source,yaml]
---------------------------------------------------
xpack.monitoring.elasticsearch.url: [ "http://localhost:9200" ]
xpack.monitoring.elasticsearch.hosts: [ "http://localhost:9200" ]
---------------------------------------------------

All data produced by {monitoring} for Logstash is indexed in the monitoring
Expand All @@ -36,7 +36,7 @@ necessary to properly configure Logstash. For more information, see

IMPORTANT: When discussing security relative to the `elasticsearch` output, it
is critical to remember that all users are managed on the production cluster,
which is identified in the `xpack.monitoring.elasticsearch.url` setting.
which is identified in the `xpack.monitoring.elasticsearch.hosts` setting.
This is particularly important to remember when you move from development
environments to production environments, where you often have dedicated
monitoring clusters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SSL, you need to specify additional SSL settings.
[source,shell]
-----
xpack.management.enabled: true
xpack.management.elasticsearch.url: "http://localhost:9200/"
xpack.management.elasticsearch.hosts: "http://localhost:9200/"
xpack.management.elasticsearch.username: logstash_admin_user
xpack.management.elasticsearch.password: t0p.s3cr3t
xpack.management.logstash.poll_interval: 5s
Expand All @@ -41,7 +41,7 @@ Specify a comma-separated list of pipeline IDs to register for centralized
pipeline management. After changing this setting, you need to restart Logstash
to pick up changes.

`xpack.management.elasticsearch.url`::
`xpack.management.elasticsearch.hosts`::

The {es} instance that will store the Logstash pipeline configurations and
metadata. This might be the same {es} instance specified in the `outputs`
Expand All @@ -56,7 +56,7 @@ authenticate for accessing the configuration data. The username you specify here
should have the `logstash_admin` role, which provides access to `.logstash-*`
indices for managing configurations.

`xpack.management.elasticsearch.ssl.ca`::
`xpack.management.elasticsearch.ssl.certificate_authority`::

Optional setting that enables you to specify a path to the `.pem` file for the
certificate authority for your {es} instance.
Expand Down
4 changes: 2 additions & 2 deletions docs/static/settings/monitoring-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Logstash, see <<logstash-settings-file>>.

Monitoring is disabled by default. Set to `true` to enable {xpack} monitoring.

`xpack.monitoring.elasticsearch.url`::
`xpack.monitoring.elasticsearch.hosts`::

The {es} instances that you want to ship your Logstash metrics to. This might be
the same {es} instance specified in the `outputs` section in your Logstash
Expand Down Expand Up @@ -53,7 +53,7 @@ You can configure the following Transport Layer Security (TLS) or
Secure Sockets Layer (SSL) settings. For more information, see
<<ls-monitoring-user>>.

`xpack.monitoring.elasticsearch.ssl.ca`::
`xpack.monitoring.elasticsearch.ssl.certificate_authority`::

Optional setting that enables you to specify a path to the `.pem` file for the
certificate authority for your {es} instance.
Expand Down
4 changes: 2 additions & 2 deletions x-pack/lib/config_management/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def additionals_settings(settings)
settings.register(LogStash::Setting::ArrayCoercible.new("xpack.management.pipeline.id", String, ["main"]))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.username", "logstash_system"))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.password"))
settings.register(LogStash::Setting::ArrayCoercible.new("xpack.management.elasticsearch.url", String, [ "https://localhost:9200" ] ))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.ssl.ca"))
settings.register(LogStash::Setting::ArrayCoercible.new("xpack.management.elasticsearch.hosts", String, [ "https://localhost:9200" ] ))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.ssl.certificate_authority"))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.ssl.truststore.path"))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.ssl.truststore.password"))
settings.register(LogStash::Setting::NullableString.new("xpack.management.elasticsearch.ssl.keystore.path"))
Expand Down
6 changes: 3 additions & 3 deletions x-pack/lib/helpers/elasticsearch_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module LogStash module Helpers
module ElasticsearchOptions
extend self

ES_SETTINGS =%w(ssl.ca ssl.truststore.path ssl.keystore.path url username password)
ES_SETTINGS =%w(ssl.certificate_authority ssl.truststore.path ssl.keystore.path hosts username password)

# Retrieve elasticsearch options from either specific settings, or modules if the setting is not there and the
# feature supports falling back to modules if the feature is not specified in logstash.yml
Expand All @@ -19,13 +19,13 @@ def es_options_from_settings_or_modules(feature, settings)
def es_options_from_settings(feature, settings)
opts = {}

opts['hosts'] = settings.get("xpack.#{feature}.elasticsearch.url")
opts['hosts'] = settings.get("xpack.#{feature}.elasticsearch.hosts")
opts['user'] = settings.get("xpack.#{feature}.elasticsearch.username")
opts['password'] = settings.get("xpack.#{feature}.elasticsearch.password")
opts['sniffing'] = settings.get("xpack.#{feature}.elasticsearch.sniffing")
opts['ssl_certificate_verification'] = settings.get("xpack.#{feature}.elasticsearch.ssl.verification_mode") == 'certificate'

if cacert = settings.get("xpack.#{feature}.elasticsearch.ssl.ca")
if cacert = settings.get("xpack.#{feature}.elasticsearch.ssl.certificate_authority")
opts['cacert'] = cacert
opts['ssl'] = true
end
Expand Down
10 changes: 5 additions & 5 deletions x-pack/lib/monitoring/monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ def after_agent(runner)

# For versions prior to 6.3 the default value of "xpack.monitoring.enabled" was true
# For versions 6.3+ the default of "xpack.monitoring.enabled" is false.
# To help keep passivity, assume that if "xpack.monitoring.elasticsearch.url" has been set that monitoring should be enabled.
# return true if xpack.monitoring.enabled=true (explicitly) or xpack.monitoring.elasticsearch.url is configured
# To help keep passivity, assume that if "xpack.monitoring.elasticsearch.hosts" has been set that monitoring should be enabled.
# return true if xpack.monitoring.enabled=true (explicitly) or xpack.monitoring.elasticsearch.hosts is configured
def monitoring_enabled?(settings)
return settings.get_value("xpack.monitoring.enabled") if settings.set?("xpack.monitoring.enabled")

if settings.set?("xpack.monitoring.elasticsearch.url")
if settings.set?("xpack.monitoring.elasticsearch.hosts")
logger.warn("xpack.monitoring.enabled has not been defined, but found elasticsearch configuration. Please explicitly set `xpack.monitoring.enabled: true` in logstash.yml")
true
else
Expand Down Expand Up @@ -169,12 +169,12 @@ def additionals_settings(settings)
logger.trace("registering additionals_settings")

settings.register(LogStash::Setting::Boolean.new("xpack.monitoring.enabled", false))
settings.register(LogStash::Setting::ArrayCoercible.new("xpack.monitoring.elasticsearch.url", String, [ "http://localhost:9200" ] ))
settings.register(LogStash::Setting::ArrayCoercible.new("xpack.monitoring.elasticsearch.hosts", String, [ "http://localhost:9200" ] ))
settings.register(LogStash::Setting::TimeValue.new("xpack.monitoring.collection.interval", "10s"))
settings.register(LogStash::Setting::TimeValue.new("xpack.monitoring.collection.timeout_interval", "10m"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.username", "logstash_system"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.password"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.ssl.ca"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.ssl.certificate_authority"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.ssl.truststore.path"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.ssl.truststore.password"))
settings.register(LogStash::Setting::NullableString.new("xpack.monitoring.elasticsearch.ssl.keystore.path"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"xpack.management.enabled" => true,
"xpack.management.pipeline.id" => @pipelines.keys,
"xpack.management.logstash.poll_interval" => "1s",
"xpack.management.elasticsearch.url" => ["http://localhost:9200"],
"xpack.management.elasticsearch.hosts" => ["http://localhost:9200"],
"xpack.management.elasticsearch.username" => "elastic",
"xpack.management.elasticsearch.password" => elastic_password,
"xpack.monitoring.elasticsearch.username" => "elastic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def logstash_options(pipeline_id, wait_condition)
"xpack.management.enabled" => true,
"xpack.management.pipeline.id" => pipeline_id,
"xpack.management.logstash.poll_interval" => "1s",
"xpack.management.elasticsearch.url" => ["http://localhost:9200"],
"xpack.management.elasticsearch.hosts" => ["http://localhost:9200"],
"xpack.management.elasticsearch.username" => "elastic",
"xpack.management.elasticsearch.password" => elastic_password,
"xpack.monitoring.elasticsearch.username" => "elastic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@logstash_service = logstash("bin/logstash -e '#{config}' -w 1", {
:settings => {
"xpack.monitoring.elasticsearch.url" => ["http://localhost:9200", "http://localhost:9200"],
"xpack.monitoring.elasticsearch.hosts" => ["http://localhost:9200", "http://localhost:9200"],
"xpack.monitoring.collection.interval" => "1s",
"xpack.monitoring.elasticsearch.username" => "elastic",
"xpack.monitoring.elasticsearch.password" => elastic_password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@logstash_service = logstash("bin/logstash -e '#{config}' -w 1", {
:settings => {
"xpack.monitoring.elasticsearch.url" => ["http://localhost:9200", "http://localhost:9200"],
"xpack.monitoring.elasticsearch.hosts" => ["http://localhost:9200", "http://localhost:9200"],
"xpack.monitoring.collection.interval" => "1s",
"queue.type" => "persisted",
"xpack.monitoring.elasticsearch.username" => "elastic",
Expand Down
4 changes: 2 additions & 2 deletions x-pack/spec/config_management/elasticsearch_source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{
"xpack.management.enabled" => true,
"xpack.management.pipeline.id" => "main",
"xpack.management.elasticsearch.url" => elasticsearch_url,
"xpack.management.elasticsearch.hosts" => elasticsearch_url,
"xpack.management.elasticsearch.username" => elasticsearch_username,
"xpack.management.elasticsearch.password" => elasticsearch_password,
}
Expand All @@ -109,7 +109,7 @@
{
"xpack.management.enabled" => true,
"xpack.management.pipeline.id" => "main",
"xpack.management.elasticsearch.url" => elasticsearch_url,
"xpack.management.elasticsearch.hosts" => elasticsearch_url,
"xpack.management.elasticsearch.username" => elasticsearch_username,
#"xpack.management.elasticsearch.password" => elasticsearch_password,
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/spec/config_management/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"xpack.management.enabled" => [LogStash::Setting::Boolean, false],
"xpack.management.logstash.poll_interval" => [LogStash::Setting::TimeValue, 5000000000],
"xpack.management.pipeline.id" => [LogStash::Setting::ArrayCoercible, ["main"]],
"xpack.management.elasticsearch.url" => [LogStash::Setting::ArrayCoercible, ["https://localhost:9200"]],
"xpack.management.elasticsearch.hosts" => [LogStash::Setting::ArrayCoercible, ["https://localhost:9200"]],
"xpack.management.elasticsearch.username" => [LogStash::Setting::String, "logstash_system"],
"xpack.management.elasticsearch.password" => [LogStash::Setting::String, nil],
"xpack.management.elasticsearch.ssl.ca" => [LogStash::Setting::NullableString, nil],
"xpack.management.elasticsearch.ssl.certificate_authority" => [LogStash::Setting::NullableString, nil],
"xpack.management.elasticsearch.ssl.truststore.path" => [LogStash::Setting::NullableString, nil],
"xpack.management.elasticsearch.ssl.truststore.password" => [LogStash::Setting::NullableString, nil],
"xpack.management.elasticsearch.ssl.keystore.path" => [LogStash::Setting::NullableString, nil],
Expand Down
8 changes: 4 additions & 4 deletions x-pack/spec/helpers/elasticsearch_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
shared_examples 'elasticsearch options hash is populated with secure options' do
context "with ca" do
let(:elasticsearch_ca) { Stud::Temporary.file.path }
let(:settings) { super.merge({ "xpack.monitoring.elasticsearch.ssl.ca" => elasticsearch_ca })}
let(:settings) { super.merge({ "xpack.monitoring.elasticsearch.ssl.certificate_authority" => elasticsearch_ca })}

it "creates the elasticsearch output options hash" do
expect(test_class.es_options_from_settings('monitoring', system_settings)).to include(
Expand Down Expand Up @@ -101,7 +101,7 @@
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand All @@ -116,7 +116,7 @@
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand Down Expand Up @@ -223,7 +223,7 @@
"cloud.id" => cloud_id,
"cloud.auth" => "#{cloud_username}:#{cloud_password}",
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/spec/license_checker/license_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def update(license)
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/spec/license_checker/license_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def update(xpack_info)
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/spec/license_checker/license_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/spec/monitoring/inputs/metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
let(:settings) do
{
"xpack.monitoring.enabled" => true,
"xpack.monitoring.elasticsearch.url" => elasticsearch_url,
"xpack.monitoring.elasticsearch.hosts" => elasticsearch_url,
"xpack.monitoring.elasticsearch.username" => elasticsearch_username,
"xpack.monitoring.elasticsearch.password" => elasticsearch_password,
}
end

let(:es_options) do
{
'url' => elasticsearch_url,
'hosts' => elasticsearch_url,
'user' => elasticsearch_username,
'password' => elasticsearch_password
}
Expand Down
Loading

0 comments on commit 6990d08

Please sign in to comment.