# Logstash taking wrong url for Elasticserach

**URL:** <https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527>\
**Category:** Logstash\
**Created:** [June 10, 2021, 7:43am UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527 "2021-06-10T07:43:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubham\_Dhote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shubham_dhote/32/76864_2.png) [@Shubham\_Dhote](https://discuss.elastic.co/u/Shubham_Dhote)\
**Post date:** [June 10, 2021, 7:43am UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/1 "2021-06-10T07:43:46Z")

</div>

Hi, I have deployed elasticserach and logstash in kubernetes cluster. And my logstash is unable to connect to elasticserach.

Problem is:- my elasticserach url is:- [https://my-server.com/elasticsearch](https://my-server.com/elasticsearch)

And logstash is taking:- [https://my-server.com:9200/elasticsearch](https://my-server.com:9200/elasticsearch) as a result of which it is getting connection timeout, not sure why it is taking ([https://my-server.com:9200/elasticsearch](https://my-server.com:9200/elasticsearch)), I have mentioned the host as ([https://my-server.com/elasticsearch](https://my-server.com/elasticsearch)) in my logstash.conf file.

Note:- My elasticsearch is accessible only through ([https://my-server.com/elasticsearch](https://my-server.com/elasticsearch)), where as logstash is taking ([https://my-server.com:9200/elasticsearch](https://my-server.com:9200/elasticsearch))

Can someone help with this issue.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 10, 2021, 2:54pm UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/2 "2021-06-10T14:54:19Z")

</div>

> [@Shubham\_Dhote](#):
>
> not sure why it is taking ([https://my-server.com:9200/elasticsearch](https://my-server.com:9200/elasticsearch)), I have mentioned the host as ([https://my-server.com/elasticsearch](https://my-server.com/elasticsearch)) in my logstash.conf file

Because in the elasticsearch output [code](https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/2f8ebf0340e678d0c60c077fd54a58427675a0b4/lib/logstash/outputs/elasticsearch/http_client.rb#L269) the default port is 9200. If you want it to use something else (e.g. 80) then you need to explicitly set that in the URL.

---

<div class="post-metadata">

**Author:** ![Shubham\_Dhote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shubham_dhote/32/76864_2.png) [@Shubham\_Dhote](https://discuss.elastic.co/u/Shubham_Dhote)\
**Post date:** [June 10, 2021, 3:16pm UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/3 "2021-06-10T15:16:16Z")

</div>

Hi, I want the url just to be [https://my-server.com/elasticsearch](https://my-server.com/elasticsearch). But in the logstash output it is taking [https://my-server.com:9200/elasticsearch](https://my-server.com:9200/elasticsearch).

I have explicitly mentioned as [https://my-server.com/elasticsearch](https://my-server.com/elasticsearch) only.

---

<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 10, 2021, 3:31pm UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/4 "2021-06-10T15:31:05Z")

</div>

As badger said, you need to specify the port in your logstash configuration, if you do not specify the port logstash will use the port `9200`.

In your case you should try to set `hosts => "https://my-server.com:443/elasticsearch` in your elasticsearch output.

---

<div class="post-metadata">

**Author:** ![Shubham\_Dhote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shubham_dhote/32/76864_2.png) [@Shubham\_Dhote](https://discuss.elastic.co/u/Shubham_Dhote)\
**Post date:** [June 10, 2021, 4:52pm UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/5 "2021-06-10T16:52:36Z")

</div>

Okay, I will try with port 443.

---

<div class="post-metadata">

**Author:** ![Shubham\_Dhote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shubham_dhote/32/76864_2.png) [@Shubham\_Dhote](https://discuss.elastic.co/u/Shubham_Dhote)\
**Post date:** [June 11, 2021, 4:12am UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/6 "2021-06-11T04:12:57Z")

</div>

Thanks Leandrojmp, it is working now.

---

<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 9, 2021, 4:13am UTC](https://discuss.elastic.co/t/logstash-taking-wrong-url-for-elasticserach/275527/7 "2021-07-09T04:13:25Z")

</div>

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