"Operation timed out" while accessing Kibana

Hi,

I have installed X-pack on Elasticsearch and Kibana on the server. I'm able to access Elasticsearch from my machine (which is on the same network) but not able to access Kibana.

From the terminal, I'm getting the following message (which means Kibana is working fine right?)
[root@elk01 ~]# curl -u elastic:ELKPassword http://localhost:5601
script>var hashRoute = '/app/kibana';
var defaultRoute = '/app/kibana';

var hash = window.location.hash;
if (hash.length) {
window.location = hashRoute + hash;
} else {
window.location = defaultRoute;
}[root@elk01 ~]#

But when I access from a remote machine, in the browser it says "tcp_error: A communication error occurred: "Operation timed out" ".
I'm using the following kibana.yml file.

# Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601

# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "localhost"
network.host: 0.0.0.0
# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# to Kibana. This setting cannot end in a slash.
#server.basePath: ""

# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576

# The Kibana server's name.  This is used for display purposes.
#server.name: "your-hostname"

# The URL of the Elasticsearch instance to use for all your queries.
#elasticsearch.url: "http://localhost:9200"

# When this setting's value is true Kibana uses the hostname specified in the server.host
# setting. When the value of this setting is false, Kibana uses the hostname of the host
# that connects to this Kibana instance.
#elasticsearch.preserveHost: true

# Kibana uses an index in Elasticsearch to store saved searches, visualizations and
# dashboards. Kibana creates a new index if the index doesn't already exist.
#kibana.index: ".kibana"

# The default application to load.
#kibana.defaultAppId: "discover"

# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
elasticsearch.username: "elastic"
elasticsearch.password: "ELKPassword"

# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: false
#server.ssl.certificate: /path/to/your/server.crt
#server.ssl.key: /path/to/your/server.key

# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files validate that your Elasticsearch backend uses the same key files.
#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key

# Optional setting that enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]

# To disregard the validity of SSL certificates, change this setting's value to 'none'.
#elasticsearch.ssl.verificationMode: full

# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
# the elasticsearch.requestTimeout setting.
#elasticsearch.pingTimeout: 1500

# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
# must be a positive integer.
#elasticsearch.requestTimeout: 30000

# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
# headers, set this value to [] (an empty list).
#elasticsearch.requestHeadersWhitelist: [ authorization ]

# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
#elasticsearch.customHeaders: {}

# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 0

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.
#elasticsearch.startupTimeout: 5000

# Specifies the path where Kibana creates the process ID file.
#pid.file: /var/run/kibana.pid

# Enables you specify a file where Kibana stores log output.
#logging.dest: stdout

# Set the value of this setting to true to suppress all logging output.
#logging.silent: false

# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false

# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false

# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000

# The default locale. This locale can be used in certain circumstances to substitute any missing
# translations.
#i18n.defaultLocale: "en"

#xpack.security.authc.accept_default_password: false

Please let me know if any configuration has to be changed.
Thanks in advance,
Dharma Sanjay Reddy M.

Could you try reformat that config you posted, by placing it in triple backticks (```) ?

That would make this way easier to follow :slight_smile:

Cheers,
Tim

Format change Done :slight_smile:

Hi Sanjay,

you should change the server.host to point to 0.0.0.0 to be available from the outside and not just localhost. The network.host is actually a configuration option from the elasticsearch.yml, so I think this shouldn't be in there.

Cheers,
Tim

Thanks for the quick response Tim :slight_smile:
I have tried removing network.host and have changed server.host to 0.0.0.0 .
But no luck :frowning:
Still not able to connect to kibana.

Could you give me the output of netstat -tulpen if you are running on a Linux system (if not, I would have to look up the parameters)?

Hi Tim,
Please find the output for netstat -tulpen

[root@elk01 ~]# netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          14068      1600/sshd
tcp        0      0 0.0.0.0:5601            0.0.0.0:*               LISTEN      995        205838     29691/node
tcp6       0      0 :::9200                 :::*                    LISTEN      996        23143      2795/java
tcp6       0      0 ::1:9300                :::*                    LISTEN      996        24112      2795/java
tcp6       0      0 :::22                   :::*                    LISTEN      0          14070      1600/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      0          18483      2225/master
udp        0      0 127.0.0.1:323           0.0.0.0:*                           997        15502      697/chronyd
udp6       0      0 ::1:323                 :::*                                997        15503      697/chronyd
udp6       0      0 :::52311                :::*                                0          258330     2262/BESClient

Regards,
Dharma Sanjay Reddy M.

According to that, your Kibana should already be available from the outside. Do you maybe have any firewalls, filtering, reverse proxying, etc. running before that infrastructure?

E.g. if you are running on a cloud provider, you would usually need to manually allow those ports.

Maybe your hosting provider offers some documentation on their firewall configuration? Because just from the server side, this looks perfectly fine.

Cheers,
Tim

Both the ports 9200 and 5601 are open. What bothers me is I'm able to access Elasticsearch remotely but only Kibana is creating this issue :frowning:

The only thing I currently see that could still possible is: are you trying to access the server via IPv4 or IPv6, since Elasticsearch listens to both, whereas Kibana listens to only IPv4 at the moment?

Cheers,
Tim

Sorry for asking this question,
How to know through which i'm accessing Kibana/Elasticsearch.

You could to a -v to curl when you are trying to access it, and post the topmost output (basically before the HTTP request begins). It should show something like:

* Rebuilt URL to: http://localhost:5601/
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 5601 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5601 (#0)
> GET / HTTP/1.1

Where you see "Connected to localhost (127.0.0.1)" which means we are connected via the IPv4 address 127.0.0.1 to Kibana.

when I try the same, I'm getting the below message

[root@elk01 ~]# curl -v -u elastic:changeme http://0.0.0.0:5601
* About to connect() to 0.0.0.0 port 5601 (#0)
*   Trying 0.0.0.0...
* Connected to 0.0.0.0 (0.0.0.0) port 5601 (#0)
* Server auth using Basic with user 'elastic'
> GET / HTTP/1.1
> Authorization: Basic ZWxhc3RpYzpFTEtQYXNzd29yZA==
> User-Agent: curl/7.29.0
> Host: 0.0.0.0:5601
> Accept: */*
>
< HTTP/1.1 200 OK
< kbn-name: kibana
< kbn-version: 5.6.3
< kbn-xpack-sig: 7843aa9b405ce2f9a4e6ed3183a00ec1
< cache-control: no-cache
< content-type: text/html; charset=utf-8
< content-length: 217
< accept-ranges: bytes
< Date: Tue, 24 Oct 2017 12:58:07 GMT
< Connection: keep-alive
<
<script>var hashRoute = '/app/kibana';
var defaultRoute = '/app/kibana';

var hash = window.location.hash;
if (hash.length) {
  window.location = hashRoute + hash;
} else {
  window.location = defaultRoute;
* Connection #0 to host 0.0.0.0 left intact
}</script>[root@elk01 ~]#

When I tried using localhost, it gives the below message

[root@elk01 ~]# curl -v -u elastic:changeme http://localhost:5601
* About to connect() to localhost port 5601 (#0)
*   Trying ::1...
* Connection refused
* Failed connect to localhost:5601; Connection refused
* Closing connection 0
curl: (7) Failed connect to localhost:5601; Connection refused

Please let me know if I have to change anything:frowning:

Oh, sorry I was confusing there. I meant you should try the curl from your local machine, that is not able to connect to Kibana and use the regular Domain Name, that you are using to try to connect to it :slight_smile:

I'm trying to connect from a windows machine. Not able to use CURL. Can you please let me know what should I use other than CURL.

You could try to do a ping <kibana-url> instead. Also if you open it in the browser, you could maybe open the Browser Dev Tools (F12) and check in the Network tab (named that way in Chrome) for the connection and check whether it provides some additional information.

Cheers,
Tim

When I run it on the browser, it says "tcp_error: A communication error occurred: "Operation timed out"
Have checked with network/Headers for more error information, got the below message:

Request URL:http://121.215.229.352:5601/
Request Method:GET
Status Code:503 Service Unavailable
Remote Address:10.205.123.32:8080
Referrer Policy:no-referrer-when-downgrade
Response Headers
Cache-Control:no-cache
Connection:Keep-Alive
Content-Length:513
Content-Type:text/html; charset=utf-8
Pragma:no-cache
Proxy-Connection:Keep-Alive
Request Headers
Provisional headers are shown
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Is this because of any timeout issue?

Have installed the same on windows machine which is working absolutely fine. Not sure whats happening :frowning:

Oh that is definitely helpful :slight_smile:

Kibana is not the source of your problems :slight_smile: In your infrastructure apparently a reverse proxy is proxying away Kibana, and that proxy cannot reach Kibana (for whatever reasons - maybe misconfigured?)

Looking closer to what you typed, that proxy might also just be your regular company proxy? You entered 121.215.229.352:5601 as an address? Because that looks a lot like it should be an IP address, but infact it has 352 as a last block which is not valid inside an IP address. So the 503 service unavailable from your proxy might just be: it doesn't know what to do with this IP address if it's a company proxy.

Please check again, what the IP/URL of your server should actually be.

My bad @timroes
Due to security issues I have changed the IP.

Before installing X-Pack everything was working fine, If it is a problem with reverse proxy, then it shouldn't work before as well right?
After installing X-Pack, am not able to access Kibana... But am able to access Elasticsearch.
I'm Damn stuck and don't know what to do :frowning:

It could still be. You should look in the reverse proxy logs to check what issues that proxy exactly has accessing Kibana, why it's returning a 503 service unavailable. I fear without accessing the reverse proxy you won't be able to find any more clues.