{"action":"created","issue":{"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/400","repository_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/400/labels{/name}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/400/comments","events_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/400/events","html_url":"https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/400","id":143394299,"number":400,"title":"support underscores in hostnames","user":{"login":"cooniur","id":3030052,"avatar_url":"https://avatars.githubusercontent.com/u/3030052?v=3","gravatar_id":"","url":"https://api.github.com/users/cooniur","html_url":"https://github.com/cooniur","followers_url":"https://api.github.com/users/cooniur/followers","following_url":"https://api.github.com/users/cooniur/following{/other_user}","gists_url":"https://api.github.com/users/cooniur/gists{/gist_id}","starred_url":"https://api.github.com/users/cooniur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooniur/subscriptions","organizations_url":"https://api.github.com/users/cooniur/orgs","repos_url":"https://api.github.com/users/cooniur/repos","events_url":"https://api.github.com/users/cooniur/events{/privacy}","received_events_url":"https://api.github.com/users/cooniur/received_events","type":"User","site_admin":false},"labels":[{"id":139633104,"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/labels/bug","name":"bug","color":"e11d21","default":true},{"id":362678434,"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/labels/P2","name":"P2","color":"000000","default":false}],"state":"open","locked":false,"assignee":{"login":"jsvd","id":31809,"avatar_url":"https://avatars.githubusercontent.com/u/31809?v=3","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false},"assignees":[{"login":"jsvd","id":31809,"avatar_url":"https://avatars.githubusercontent.com/u/31809?v=3","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false}],"milestone":null,"comments":22,"created_at":"2016-03-25T00:25:42Z","updated_at":"2016-12-22T12:10:10Z","closed_at":null,"body":"Elasticsearch version: 1.5.0\r\nLogstash version: 2.2.0\r\nOS: Ubuntu_14.04.3_LTS_HVM (`uname -a = Linux my-test-logstash-1-us-west-2 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux`)\r\nCloud platform: AWS\r\n# Details\r\n\r\nFor the following two configs, Logstash gives different errors respectively. The 3rd config works well, though, but is not practical in a cloud environment like AWS.\r\n## Config 1 (failed)\r\n\r\n```\r\noutput {\r\n  elasticsearch {\r\n      hosts => [\"http://es_myapp.us-west-2.test.mydomain.net:9200\"]\r\n      index => \"logstash-%{+YYYYMMdd}\"\r\n      document_type => \"%{[@metadata][type]}\"\r\n  }\r\n}\r\n```\r\n\r\nError message:\r\n\r\n```\r\nAttempted to send a bulk request to Elasticsearch configured at '[\"http://http://es_myapp.us-west-2.test.mydomain.net:9200/\"]', but an error occurred and it failed! Are you sure you can reach elasticsearch from this machine using the configuration provided? {:client_config=>{:hosts=>[\"http://http://es_myapp.us-west-2.test.mydomain.net:9200/\"], :ssl=>nil, :transport_options=>{:socket_timeout=>0, :request_timeout=>0, :proxy=>nil, :ssl=>{}}, :transport_class=>Elasticsearch::Transport::Transport::HTTP::Manticore, ...\r\n```\r\n\r\nNote the extra \"`http://`\" in the `:hosts=>` field in the error message. I believe this should definitely be a bug.\r\n## Config 2 (failed)\r\n\r\n```\r\noutput {\r\n  elasticsearch {\r\n      hosts => [\"es_myapp.us-west-2.test.mydomain.net:9200\"]\r\n      index => \"logstash-%{+YYYYMMdd}\"\r\n      document_type => \"%{[@metadata][type]}\"\r\n  }\r\n}\r\n```\r\n\r\nError message:\r\n\r\n```\r\nThe error reported is:\r\n  the scheme http does not accept registry part: es_myapp.us-west-2.test.mydomain.net:9200 (or bad hostname?)\r\n/apps/logstash-2.2.0/vendor/jruby/lib/ruby/1.9/uri/generic.rb:214:in `initialize'\r\n/apps/logstash-2.2.0/vendor/jruby/lib/ruby/1.9/uri/http.rb:84:in `initialize'\r\n/apps/logstash-2.2.0/vendor/jruby/lib/ruby/1.9/uri/common.rb:214:in `parse'\r\n/apps/logstash-2.2.0/vendor/jruby/lib/ruby/1.9/uri/common.rb:747:in `parse'\r\n/apps/logstash-2.2.0/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.15/lib/elasticsearch/transport/client.rb:155:in `__extract_hosts'\r\norg/jruby/RubyArray.java:2414:in `map'\r\n/apps/logstash-2.2.0/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.15/lib/elasticsearch/transport/client.rb:151:in `__extract_hosts'\r\n/apps/logstash-2.2.0/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.15/lib/elasticsearch/transport/client.rb:115:in `initialize'\r\n/apps/logstash-2.2.0/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.15/lib/elasticsearch/transport.rb:26:in `new'\r\n/apps/logstash-2.2.0/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.4.1-java/lib/logstash/outputs/elasticsearch/http_client.rb:136:in `build_client'\r\n```\r\n## Config 3 (passed)\r\n\r\n```\r\noutput {\r\n  elasticsearch {\r\n      hosts => [\"100.10.10.10:9200\"]               # 100.10.10.10 is the IP address of es_myapp.us-west-2.test.mydomain.net\r\n      index => \"logstash-%{+YYYYMMdd}\"\r\n      document_type => \"%{[@metadata][type]}\"\r\n  }\r\n}\r\n```\r\n\r\nThis works, however, I'm in AWS environment and cannot rely on IP addresses.\r\n\r\nThe minimum requirement is that for Config 1 the parsing should work.\r\n\r\nPlease take a look at. Thanks in advance!\r\n\r\n=================\r\nUpdated: \r\n\r\nWith Logstash 2.2.2 and logstash-output-elasticsearch 2.1, the issue still exists (see the 5th reply).\r\n\r\nTried to update the plugin to 2.5.5, however, the upgrade may have corrupted Logstash, and it now fails to start with error:\r\n\r\n```\r\nThe error reported is:\r\n\r\n        you might need to reinstall the gem which depends on the missing jar or in case there is Jars.lock then resolve the jars with `lock_jars` command\r\n\r\nno such file to load -- org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1 (LoadError)\r\n```\r\n# \r\n\r\n================\r\nUpdated 11/1/16: put the above update _under_ the original post to avoid confusion.\r\n"},"comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/comments/268787151","html_url":"https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/400#issuecomment-268787151","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/400","id":268787151,"user":{"login":"jsvd","id":31809,"avatar_url":"https://avatars.githubusercontent.com/u/31809?v=3","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T12:10:10Z","updated_at":"2016-12-22T12:10:10Z","body":"One alternative is to use the [addressable gem](https://rubygems.org/gems/addressable/versions/2.4.0)'s uri parser. this gem is already included in the logstash release and seems to conform better with the rfcs:\r\n\r\n```\r\n/tmp/logstash-5.1.1 % bin/logstash -i irb\r\njruby-1.7.25 :001 > URI.parse(\"http://es_myapp.us-west-2.test.mydomain.net:9200\")\r\nURI::InvalidURIError: the scheme http does not accept registry part: es_myapp.us-west-2.test.mydomain.net:9200 (or bad hostname?)\r\n\tfrom /private/tmp/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/generic.rb:214:in `initialize'\r\n\tfrom /private/tmp/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/http.rb:84:in `initialize'\r\n\tfrom /private/tmp/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:214:in `parse'\r\n\tfrom /private/tmp/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:747:in `parse'\r\n\tfrom (irb):7:in `evaluate'\r\n\tfrom org/jruby/RubyKernel.java:1079:in `eval'\r\n\tfrom org/jruby/RubyKernel.java:1479:in `loop'\r\njruby-1.7.25 :002 > require \"addressable/uri\"\r\n=> true\r\njruby-1.7.25 :003 > Addressable::URI.parse(\"http://es_myapp.us-west-2.test.mydomain.net:9200\")\r\n => #<Addressable::URI:0x3005e URI:http://es_myapp.us-west-2.test.mydomain.net:9200> \r\n```"}}
{"actor":{"display_login":"jsvd"}}