# SOLVED: Logstash can not connect to elasticsearch url

**URL:** <https://discuss.elastic.co/t/solved-logstash-can-not-connect-to-elasticsearch-url/65154>\
**Category:** Logstash\
**Created:** [November 7, 2016, 12:51am UTC](https://discuss.elastic.co/t/solved-logstash-can-not-connect-to-elasticsearch-url/65154 "2016-11-07T00:51:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![w0lverine](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@w0lverine](https://discuss.elastic.co/u/w0lverine)\
**Post date:** [November 7, 2016, 12:51am UTC](https://discuss.elastic.co/t/solved-logstash-can-not-connect-to-elasticsearch-url/65154/1 "2016-11-07T00:51:06Z")

</div>

Every time ./logstash -f sample.conf is run I get this error:

> The stdin plugin is now waiting for input:  
> [2016-11-06T19:35:35,739][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>["[http://localhost:9200](http://localhost:9200)"]}}  
> [2016-11-06T19:35:35,755][INFO][logstash.outputs.elasticsearch] Using mapping template from {:path=\>nil}  
> [2016-11-06T19:35:35,859][WARN][logstash.outputs.elasticsearch] Marking url as dead. {:reason=\>"Elasticsearch Unreachable: [[http://localhost:9200](http://localhost:9200)][Manticore::SocketException] Connection refused (Connection refused)", :url=\>#\<URI::HTTP:0x4465037 URL:[http://localhost:9200](http://localhost:9200)\>, :error\_message=\>"Elasticsearch Unreachable: [[http://localhost:9200](http://localhost:9200)][Manticore::SocketException] Connection refused (Connection refused)", :error\_class=\>"LogStash::Outputs::Elasticsearch::HttpClient::Pool::HostUnreachableError"}  
> [2016-11-06T19:35:35,861][ERROR][logstash.outputs.elasticsearch] Failed to install template. {:message=\>"Elasticsearch Unreachable: [[http://localhost:9200](http://localhost:9200)][Manticore::SocketException] Connection refused (Connection refused)", :class=\>"LogStash::Outputs::Elasticsearch::HttpClient::Pool::HostUnreachableError"}  
> [2016-11-06T19:35:35,862][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::Elasticsearch", :hosts=\>["localhost:9200"]}  
> [2016-11-06T19:35:35,866][INFO][logstash.pipeline] Starting pipeline {"id"=\>"main", "pipeline.workers"=\>2, "pipeline.batch.size"=\>125, "pipeline.batch.delay"=\>5, "pipeline.max\_inflight"=\>250}  
> [2016-11-06T19:35:35,872][INFO][logstash.pipeline] Pipeline main started  
> [2016-11-06T19:35:35,930][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
> [2016-11-06T19:35:40,757][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:url=\>#\<URI::HTTP:0x6ea4eb0b URL:[http://localhost:9200](http://localhost:9200)\>, :healthcheck\_path=\>"/"}

I have elastic(.deb) and logstash(.zip) running on a ubutunu machine. Yes the default pool is not localhost I changed it in BOTH the elasticsearch.yml and logstash.yml files to be 192.168.2.171 and for some reason, it is not being updated. And Yes elasticsearch is successfully running on 192.168.2.171:9200.

logstash.yml:

> http.host: "192.168.2.171"

elasticsearch.yml:

> network.host: "192.168.2.171"

What other file changes do I need to make in order for logstash to recognize elasticsearch is running on 192.168.2.171 and not localhost:9200?

---

<div class="post-metadata">

**Author:** ![w0lverine](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@w0lverine](https://discuss.elastic.co/u/w0lverine)\
**Post date:** [November 7, 2016, 1:11am UTC](https://discuss.elastic.co/t/solved-logstash-can-not-connect-to-elasticsearch-url/65154/2 "2016-11-07T01:11:48Z")

</div>

SOLVED: I reinstalled logstash...I had to run logstash as root so I thought to myself maybe that was the cause, so I reinstalled it as a local user.

---

<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:** [December 5, 2016, 1:12am UTC](https://discuss.elastic.co/t/solved-logstash-can-not-connect-to-elasticsearch-url/65154/3 "2016-12-05T01:12:43Z")

</div>

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