# Logstash starts and stops within seconds while running it as a service

**URL:** <https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998>\
**Category:** Logstash\
**Created:** [July 6, 2015, 11:11pm UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998 "2015-07-06T23:11:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shriyansh\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shriyansh_jain/32/1035_2.png) [@shriyansh\_jain](https://discuss.elastic.co/u/shriyansh_jain)\
**Post date:** [July 6, 2015, 11:11pm UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998/1 "2015-07-06T23:11:15Z")

</div>

The logstash.err file spits out the following error

Faraday::ConnectionFailed: Connection refused - Connection refused  
call at /opt/logstash/vendor/bundle/jruby/1.9/gems/faraday-0.9.0/lib/faraday/adapter/net\_http.rb:44  
build\_response at /opt/logstash/vendor/bundle/jruby/1.9/gems/faraday-0.9.0/lib/faraday/rack\_builder.rb:139  
run\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/faraday-0.9.0/lib/faraday/connection.rb:377  
perform\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:24  
call at org/jruby/RubyProc.java:271  
perform\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/base.rb:187  
perform\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:20  
perform\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.1/lib/elasticsearch/transport/client.rb:102  
perform\_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-api-1.0.1/lib/elasticsearch/api/namespace/common.rb:21  
get\_template at /opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearch-api-1.0.1/lib/elasticsearch/api/actions/indices/get\_template.rb:24  
template\_exists? at /opt/logstash/lib/logstash/outputs/elasticsearch/protocol.rb:132  
template\_install at /opt/logstash/lib/logstash/outputs/elasticsearch/protocol.rb:21  
register at /opt/logstash/lib/logstash/outputs/elasticsearch.rb:259  
each at org/jruby/RubyArray.java:1613  
outputworker at /opt/logstash/lib/logstash/pipeline.rb:220  
start\_outputs at /opt/logstash/lib/logstash/pipeline.rb:152

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 7, 2015, 6:13am UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998/2 "2015-07-07T06:13:45Z")

</div>

It looks like you've configured an Elasticsearch input or output that tries to connect to something that isn't running. This shouldn't stop Logstash though.

---

<div class="post-metadata">

**Author:** ![sarbjeet](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sarbjeet](https://discuss.elastic.co/u/sarbjeet)\
**Post date:** [May 24, 2016, 5:36am UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998/3 "2016-05-24T05:36:59Z")

</div>

then whats the solution for this error?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 24, 2016, 5:39am UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998/4 "2016-05-24T05:39:55Z")

</div>

> then whats the solution for this error?

Either the configuration is incorrect or reality isn't what it should be. For example, a service that should be running isn't actually running. Without further details it's impossible to be more specific.

---

<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 6, 2017, 4:56am UTC](https://discuss.elastic.co/t/logstash-starts-and-stops-within-seconds-while-running-it-as-a-service/24998/5 "2017-07-06T04:56:33Z")

</div>


