# Connecting logstash to remote elasticsearch running on https with no port specified

**URL:** <https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [June 20, 2022, 2:24pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671 "2022-06-20T14:24:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajivraghu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajivraghu/32/107067_2.png) [@rajivraghu](https://discuss.elastic.co/u/rajivraghu)\
**Post date:** [June 20, 2022, 2:24pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671/1 "2022-06-20T14:24:25Z")

</div>

Hello ,  
i am running Elasticsearch on a website called Cloud IDE gitpod. Once i start the docker image on the gitpod,

```auto
docker run \
      --name elasticsearch \
      --net elastic \
      -p 9200:9200 \
      -e discovery.type=single-node \
      -e ES_JAVA_OPTS="-Xms1g -Xmx1g"\
      -e xpack.security.enabled=false \
      -it \
      docker.elastic.co/elasticsearch/elasticsearch:8.2.2

```

Elasticsearch will start successfully i get a full https public url to access the service.. No PORT will be given in the end:

[https://9200-xxxx.gitpod.io/](https://9200-xxxx.gitpod.io/)

When i access the url in browser, i am able to see Elasticsearch details :

```auto
{
  "name" : "3f0f5479c2cb",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "5P-U6anjQUuIEqrn6IzRvA",
  "version" : {
    "number" : "8.2.3",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "9905bfb62a3f0b044948376b4f607f70a8a151b4",
    "build_date" : "2022-06-08T22:21:36.455508792Z",
    "build_snapshot" : false,
    "lucene_version" : "9.1.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

```

When using logstash, i am not able to connect to [https://9200-xxxx.gitpod.io/](https://9200-xxxx.gitpod.io/)

```auto
elasticsearch{
        hosts => "https://9200-xxxx.gitpod.io/"
        index => "library-mgmt-system-logstasssh-index"
        ecs_compatibility => disabled
    }

```

It fails with Attempted to resurrect connection to dead ES instance, but got an error {:url=\>"[https://9200-xxxx.gitpod.io:9200/](https://9200-xxxx.gitpod.io:9200/)", :exception=\>LogStash::Outputs::Elasticsearch::HttpClient::Pool::HostUnreachableError, :message=\>"Elasticsearch Unreachable: [[https://9200-xxxx.gitpod.io:9200/](https://9200-xxxx.gitpod.io:9200/)][Manticore::ConnectTimeout]

Not sure why logstash is looking for **[https://9200-xxxx.gitpod.io:9200](https://9200-xxxx.gitpod.io:9200)**

But instead it should just connect to

```auto
https://9200-xxxx.gitpod.io

```

where Elasticsearch is running.

**[https://9200-xxxx.gitpod.io:9200](https://9200-xxxx.gitpod.io:9200)** does not resolve on gitpod. As we cannot use ports . It gives directly https url internally port forward will be done.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 20, 2022, 2:56pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671/2 "2022-06-20T14:56:32Z")

</div>

Try to use `hosts=> "https://your-host-name:443` to tell logstash to use the default `https` port.

Also, you didn't anonymize your hostname and your cluster is exposed to the internet without any kind of authentication, I would recommend that you set the security features and also change your hostname now, if it is possible.

---

<div class="post-metadata">

**Author:** ![rajivraghu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajivraghu/32/107067_2.png) [@rajivraghu](https://discuss.elastic.co/u/rajivraghu)\
**Post date:** [June 20, 2022, 5:42pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671/3 "2022-06-20T17:42:56Z")

</div>

Thanks leandro 🙂 It worked fine ..

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2022, 5:43pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-remote-elasticsearch-running-on-https-with-no-port-specified/307671/4 "2022-07-18T17:43:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
