Kibana: Elasticsearch port is 9200 if not specified on URL by default.

Created on 18 May 2018  路  5Comments  路  Source: elastic/kibana

Kibana version:
docker kibana-oss:6.2.4 image

Elasticsearch version:
docker elasticsearch-oss:6.2.4 image

Server OS version:
CentOS Linux release 7.4.1708 (Core) (from *-oss:6.2.4 docker image)

Browser version:
Google Chrome Versi贸n 66.0.3359.170

Browser OS version:
Ubuntu 18.04

Original install method (e.g. download page, yum, from source, etc.):
Pulling docker *-oss images

Describe the bug:
Request Timeout after 3000ms when trying to connect to a elasticsearch URL which port is not specified. Sample of kibana.yml file:

        server.name:       logging
        server.host:       "0"
        elasticsearch.url: http://elasticsearch-logging.mydomain.com

Steps to reproduce:

  1. Pull the elasticsearch-oss:6.2.4 container and bind the internal port 9200 to 80.
  2. Pull the kibana-oss:6.2.4 container and specify the --elasticsearch flag to the host where ES is hosted
  3. Read the logs from Kibana.

Expected behavior:
If the port is not specified AND http schema is on the URL, port should be 80 by default, which is the solution I figured out.
The previous kibana.yml file works if you modify the elasticsearch.url value to:
``` ...
elasticsearch.url: http://elasticsearch-logging.mydomain.com:80/

Plus, on verbose mode, kibana should be more specific with the log to the ES. Currently is: 

...
{"type":"log","@timestamp":"2018-05-17T15:23:59Z","tags":["status","plugin:[email protected]","error"],"pid":1,"state":"red","message":"Status changed from yellow to red - Request Timeout after 3000ms","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
...
`` Maybe a message kind ofConnecting to http://elasticsearch-logging.mydomain.com:9200 ....` could help to catch this kind of errors.

Any additional context:
Tested on a kubernetes cluster.

Operations

Most helpful comment

If the host is specified using a variable named "host" or similar, everyone can assume that the port is going to be the default. If the endpoint is specified with a variable called "url" or "endpoint", as it is the case, the port must be followed from the url standards. Actually, consider http://example.com/ and http://example.com:80/ as different network endpoints seems to be a bug. Moreover, the default value for the url variable is http://localhost:9200/ which somehow indicate that the 9200 port is needed to be provided in the url (since it is not 80). It is only my humble opinion.

All 5 comments

Thanks, Christopher.

This is not a behavior we want to change, as it'd be a pretty big break. Elasticsearch's default port is 9200, so when you don't specify a port in your Kibana configs, it will default to 9200. I can see how this could be confusing, as generally, the default port for HTTP is 80.

I agree that Kibana should log the URL + port out, which would help newcomers and veterans alike.

If the host is specified using a variable named "host" or similar, everyone can assume that the port is going to be the default. If the endpoint is specified with a variable called "url" or "endpoint", as it is the case, the port must be followed from the url standards. Actually, consider http://example.com/ and http://example.com:80/ as different network endpoints seems to be a bug. Moreover, the default value for the url variable is http://localhost:9200/ which somehow indicate that the 9200 port is needed to be provided in the url (since it is not 80). It is only my humble opinion.

i want to ask you something about kibana. when i run port 80 for another web server. and i run kibana on port 8083, but i cannot open the browser kibana. can you help me to solve this problem ?

We've modified this behavior with https://github.com/elastic/kibana/pull/21564 (coming in 7.0, breaking change). http defaults to port 80, https default to 443, anything specified will override.

I opened #24406 to track logging.

@FarhanaYusaini your best bet is opening a topic at discuss.elastic.co so we don't keep pinging everyone on this :). I think we'll need more info, for example can we verify that Kibana's running and bound to the right interface, and that port 8083 is included in the browser url, and any logs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MaartenUreel picture MaartenUreel  路  3Comments

celesteking picture celesteking  路  3Comments

bradvido picture bradvido  路  3Comments

Ginja picture Ginja  路  3Comments

ctindel picture ctindel  路  3Comments