Skip to content

normalise hosts to URI::Generics, which reliably preserve defaults#112

Open
yaauie wants to merge 1 commit into
logstash-plugins:mainfrom
yaauie:default-port-and-schema
Open

normalise hosts to URI::Generics, which reliably preserve defaults#112
yaauie wants to merge 1 commit into
logstash-plugins:mainfrom
yaauie:default-port-and-schema

Conversation

@yaauie

@yaauie yaauie commented Mar 26, 2019

Copy link
Copy Markdown
Contributor

An upstream bug in the Elasticsearch Ruby Client's handling of String host
arguments that begin with a schema (e.g., https://localhost) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a URI in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
URI::Generic, which does not have a default port.

We absorb the ssl => true case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to hosts.

We also add support for IPv6 addresses, requiring a square-bracketed notation
(see: RFC2732)

Supersedes: #104
Resolves: #110
Resolves: #111

Comment thread spec/filters/elasticsearch_spec.rb Outdated
Comment thread lib/logstash/filters/elasticsearch.rb
Comment thread lib/logstash/filters/elasticsearch.rb Outdated
Comment thread lib/logstash/filters/elasticsearch.rb Outdated
An upstream bug in the Elasticsearch Ruby Client's handling of `String` host
arguments that begin with a schema (e.g., `https://localhost`) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a `URI` in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
`URI::Generic`, which does not have a default port.

We absorb the `ssl => true` case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to `hosts`.

We also add support for IPv6 addresses, requiring a square-bracketed notation
when used in conjunction with a specified port.
(see: RFC-3986)

Supersedes: logstash-plugins#104
Resolves:   logstash-plugins#110
Resolves:   logstash-plugins#111
@yaauie yaauie force-pushed the default-port-and-schema branch from 90bf27d to b18bfb6 Compare March 27, 2019 19:21
alexcams pushed a commit to alexcams/logstash-filter-elasticsearch that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elasticsearch hosts in format ipv6 not supperted Specifying a schema (http/https) as part of a host definition will override the default port

4 participants