The newly added validation in Graylog 2.3.0 is breaking Docker Swarm support, since it's preventing anyone from using a valid domain name that contains underscores.
The Issue #4092 was closed since underscores are not allowed in a host name. But we are infact providing a domain name, which allows underscores. (RFC 2181, section 11, "Name syntax")
Therefore we should still be able to use domain names, as we were in Graylog 2.2 and below.
Upgrading from 2.2 to 2.3 should work fine.
Upgrading from 2.2 to 2.3 is not working, since a valid property in the elasticsearch_hosts is rejected by the validation implementation.
elasticsearch_hosts=http://graylog_elasticsearch:9200
Correct the implementation of the validation.
elasticsearch_hosts to a hostname with underscore (docker swarm default) - ex. http://graylog_elasticsearch:9200This prevents me from upgrading to Graylog 2.3.0+ when using Docker Swarm.
But we are infact providing a domain name, which allows underscores. (RFC 2181, section 11, "Name syntax")
No, you're providing a URI.
This being said, RFC 3986, section 3.2.2 allows the use of underscores in the "authority"/"host" part:
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
authority = [ userinfo "@" ] host [ ":" port ]
host = IP-literal / IPv4address / reg-name
reg-name = *( unreserved / pct-encoded / sub-delims )
pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
So much for the theoretical part.
In practice, the Java URI class does not support underscores in the "host" part of a URI (implementing RFC 2396):
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_141).
Type in expressions for evaluation. Or try :help.
scala> import java.net.URI
import java.net.URI
scala> URI.create("http://foo_bar.example.com").getHost
res0: String = null
scala> URI.create("http://foobar.example.com").getHost
res1: String = foobar.example.com
So even if it's correct on paper, we cannot support underscores in URIs given in the elasticsearch_hosts setting right now, because the underlying platform and libraries we're using don't support it.
I found a solution for my issue.
You can give elasticsearch a network alias that doesn't contain an underscore like this:
...
networks:
stack:
aliases:
- graylogelasticsearch
...
so that i can use elasticsearch_hosts=http://graylogelasticsearch:9200.
Still, can we consider to change the validation method ex. by replacing java.net.URI with a custom implementation that is conform to RFC 3986, section 3.2.2? As far as i saw it the only issue with the config variable is within the validation method or am i wrong?
Most helpful comment
I found a solution for my issue.
You can give elasticsearch a network alias that doesn't contain an underscore like this:
so that i can use
elasticsearch_hosts=http://graylogelasticsearch:9200.Still, can we consider to change the validation method ex. by replacing java.net.URI with a custom implementation that is conform to RFC 3986, section 3.2.2? As far as i saw it the only issue with the config variable is within the validation method or am i wrong?