# Cannot run logstash as a service, with active pipeline

**URL:** https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244
**Category:** Logstash
**Created:** [August 24, 2017, 1:45pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244 "2017-08-24T13:45:04Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![pshah7](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pshah7](https://discuss.elastic.co/u/pshah7)
#### Post date: [August 24, 2017, 1:45pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/1 "2017-08-24T13:45:05Z")

</div>

Hello,

I have installed ELK stack v5.5.2 and is working completely fine. I have started logstash as a service but it fails to initialize the pipeline. So every time I have to start logstash pipeline with

`/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/ --path.settings /etc/logstash`

I have set parameters in my logstash.yml as

```
path.config: /etc/logstash/conf.d
path.settings: /etc/logstash

```

But still it doesn't work when I restart logstash as a service.

Is there a way that I can start the logstash without passing the parameters in the cmd line?

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 24, 2017, 1:56pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/2 "2017-08-24T13:56:57Z")

</div>

Are there any log entries? They would go far in explaining what's happening.

My first guess is that it's a permissions issue. Something, somewhere doesn't have read/write access for the `logstash` user.

---

<div class="post-metadata">

### Author: ![pshah7](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pshah7](https://discuss.elastic.co/u/pshah7)
#### Post date: [August 24, 2017, 2:36pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/3 "2017-08-24T14:36:39Z")

</div>

@theuntergeek

At 10.38 I cancelled the process that was started through cmd line.  
At 11.04 I started LS through cmd line as it was not feeding data

Logs -

```
[2017-08-24T10:38:08,343][WARN][logstash.shutdownwatcher] {"inflight_count"=>0, "stalling_thread_info"=>{"other"=>[{"thread_id"=>23, "name"=>"[main]<beats", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/logstash-input-beats-3.1.23-java/lib/logstash/inputs/beats.rb:206:in `run'"}, {"thread_id"=>20, "name"=>"[main]>worker0", "current_call"=>"[...]/logstash-core/lib/logstash/util/wrapped_synchronous_queue.rb:121:in `lock'"}, {"thread_id"=>21, "name"=>"[main]>worker1", "current_call"=>"[...]/logstash-core/lib/logstash/instrument/metric_type.rb:21:in `create'"}]}}
[2017-08-24T10:38:08,387][WARN][logstash.shutdownwatcher] {"inflight_count"=>0, "stalling_thread_info"=>{"other"=>[{"thread_id"=>23, "name"=>"[main]<beats", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/logstash-input-beats-3.1.23-java/lib/logstash/inputs/beats.rb:206:in `run'"}, {"thread_id"=>20, "name"=>"[main]>worker0", "current_call"=>"[...]/logstash-core/lib/logstash/util/wrapped_synchronous_queue.rb:121:in `lock'"}, {"thread_id"=>21, "name"=>"[main]>worker1", "current_call"=>"[...]/logstash-core/lib/logstash/util/wrapped_synchronous_queue.rb:147:in `lock'"}]}}
[2017-08-24T11:04:55,290][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elastic:xxxxxx@X.X.X.X:9200/]}}
[2017-08-24T11:04:55,300][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://elastic:xxxxxx@X.X.X.X:9200/, :path=>"/"}
[2017-08-24T11:04:55,559][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://elastic:xxxxxx@X.X.X.X:9200/"}
[2017-08-24T11:04:55,562][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//X.X.X.X:9200"]}
[2017-08-24T11:04:55,654][INFO][logstash.pipeline] Starting pipeline {"id"=>"main", "pipeline.workers"=>2, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>250}
[2017-08-24T11:04:56,940][INFO][logstash.inputs.beats] Beats inputs: Starting input listener {:address=>"0.0.0.0:5044"}
[2017-08-24T11:04:57,045][INFO][logstash.pipeline] Pipeline main started
[2017-08-24T11:04:57,180][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=>9600}

```

Logs after I stopped LS which was running through cmd line

```
[2017-08-24T11:10:35,855][WARN][logstash.runner] SIGINT received. Shutting down the agent.
[2017-08-24T11:10:35,959][WARN][logstash.agent] stopping pipeline {:id=>"main"}
[2017-08-24T11:10:40,902][WARN][logstash.runner] Received shutdown signal, but pipeline is still waiting for in-flight events
to be processed. Sending another ^C will force quit Logstash, but this may cause
data loss.
[2017-08-24T11:10:40,981][WARN][logstash.shutdownwatcher] {"inflight_count"=>0, "stalling_thread_info"=>{}}
[2017-08-24T11:10:40,996][ERROR][logstash.shutdownwatcher] The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information.

```

Restarted as a service

`systemctl restart logstash.service`

No logs returned. Stated - Logstash started.

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 24, 2017, 3:20pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/4 "2017-08-24T15:20:30Z")

</div>

Logstash doesn't just need to be able to read/write the config files. It also needs to have write privileges to the log file destination directory, and it needs to have read privileges for the source files you plan on reading.

I see you removed the Elasticsearch logs that showed your ES node hit the 90% full mark:

```auto
[2017-08-24T10:37:48,949][WARN][o.e.c.r.a.DiskThresholdMonitor] [es-logger-production-node] high disk watermark [90%] exceeded on [3mLr6xKbSgKvWH7loKo9JA][es-logger-production-node][/var/lib/elasticsearch/nodes/0] free: 3.5gb[6.1%], shards will be relocated away from this node

```

While it may be somewhat tangential, that's not going to help. If you hit the 5% free mark, you won't be able to index anymore.

You also removed this gem before editing your post:

```auto
[2017-08-24T10:33:34,458][ERROR][logstash.outputs.elasticsearch] Attempted to send a bulk request to elasticsearch' but Elasticsearch appears to be unreachable or down! {:error_message=>"Elasticsearch Unreachable: [http://elastic:xxxxxx@X.X.X.X:9200/][Manticore::SocketTimeout] Read timed out", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError", :will_retry_in_seconds=>64}

```

This also suggests you have some issues on the Elasticsearch side, which very well could be related to the disk space issue (if shards are shuffling around, trying to figure out where they can fit).

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 24, 2017, 3:24pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/5 "2017-08-24T15:24:57Z")

</div>

Also, since you're using X-Pack and Monitoring, do you have the correct additions to your `logstash.yml`?

```auto
xpack.monitoring.elasticsearch.url: "http://X.X.X.X:9200"
xpack.monitoring.elasticsearch.username: xxxxxxxx
xpack.monitoring.elasticsearch.password: xxxxxxxx

```

---

<div class="post-metadata">

### Author: ![pshah7](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pshah7](https://discuss.elastic.co/u/pshah7)
#### Post date: [August 24, 2017, 3:38pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/6 "2017-08-24T15:38:51Z")

</div>

@theuntergeek correct, that was fixed. As I restarted entire stack it was throwing out error for \>5mins to lookout for empty space, but it worked fine later.

I added x-pack creds into my yml, and restarted the LS service. But it doesn't seems that pipeline got kicked off.

Attaching LS.yml

```
# Settings file in YAML
#
# Settings can be specified either in hierarchical form, e.g.:
#
# pipeline:
# batch:
# size: 125
# delay: 5
#
# Or as flat keys:
#
# pipeline.batch.size: 125
# pipeline.batch.delay: 5
#
# ------------ Node identity ------------
#
# Use a descriptive name for the node:
#
 node.name: es-logging-dev-logstash
#
# If omitted the node name will default to the machine's host name
#
# ------------ Data path ------------------
#
# Which directory should be used by logstash and its plugins
# for any persistent needs. Defaults to LOGSTASH_HOME/data
#
path.data: /var/lib/logstash
#
# ------------ Pipeline Settings --------------
#
# Set the number of workers that will, in parallel, execute the filters+outputs
# stage of the pipeline.
#
# This defaults to the number of the host's CPU cores.
#
# pipeline.workers: 2
#
# How many workers should be used per output plugin instance
#
# pipeline.output.workers: 1
#
# How many events to retrieve from inputs before sending to filters+workers
#
# pipeline.batch.size: 125
#
# How long to wait before dispatching an undersized batch to filters+workers
# Value is in milliseconds.
#
# pipeline.batch.delay: 5
#
# Force Logstash to exit during shutdown even if there are still inflight
# events in memory. By default, logstash will refuse to quit until all
# received events have been pushed to the outputs.
#
# WARNING: enabling this can lead to data loss during shutdown
#
# pipeline.unsafe_shutdown: false
#
# ------------ Pipeline Configuration Settings --------------
#
# Where to fetch the pipeline configuration for the main pipeline
#
path.config: /etc/logstash/conf.d
#
# Pipeline configuration string for the main pipeline
#
# config.string:
#
# At startup, test if the configuration is valid and exit (dry run)
#
# config.test_and_exit: false
#
# Periodically check if the configuration has changed and reload the pipeline
# This can also be triggered manually through the SIGHUP signal
#
# config.reload.automatic: false
#
# How often to check if the pipeline configuration has changed (in seconds)
#
# config.reload.interval: 3
#
# Show fully compiled configuration as debug log message
# NOTE: --log.level must be 'debug'
#
# config.debug: false
#
# ------------ Module Settings ---------------
# Define modules here. Modules definitions must be defined as an array.
# The simple way to see this is to prepend each `name` with a `-`, and keep
# all associated variables under the `name` they are associated with, and
# above the next, like this:
#
# modules:
# - name: MODULE_NAME
# var.PLUGINTYPE1.PLUGINNAME1.KEY1: VALUE
# var.PLUGINTYPE1.PLUGINNAME1.KEY2: VALUE
# var.PLUGINTYPE2.PLUGINNAME1.KEY1: VALUE
# var.PLUGINTYPE3.PLUGINNAME3.KEY1: VALUE
#
# Module variable names must be in the format of
#
# var.PLUGIN_TYPE.PLUGIN_NAME.KEY
#
# modules:
#
# ------------ Queuing Settings --------------
#
# Internal queuing model, "memory" for legacy in-memory based queuing and
# "persisted" for disk-based acked queueing. Defaults is memory
#
# queue.type: memory
#
# If using queue.type: persisted, the directory path where the data files will be stored.
# Default is path.data/queue
#
# path.queue:
#
# If using queue.type: persisted, the page data files size. The queue data consists of
# append-only data files separated into pages. Default is 250mb
#
# queue.page_capacity: 250mb
#
# If using queue.type: persisted, the maximum number of unread events in the queue.
# Default is 0 (unlimited)
#
# queue.max_events: 0
#
# If using queue.type: persisted, the total capacity of the queue in number of bytes.
# If you would like more unacked events to be buffered in Logstash, you can increase the
# capacity using this setting. Please make sure your disk drive has capacity greater than
# the size specified here. If both max_bytes and max_events are specified, Logstash will pick
# whichever criteria is reached first
# Default is 1024mb or 1gb
#
# queue.max_bytes: 1024mb
#
# If using queue.type: persisted, the maximum number of acked events before forcing a checkpoint
# Default is 1024, 0 for unlimited
#
# queue.checkpoint.acks: 1024
#
# If using queue.type: persisted, the maximum number of written events before forcing a checkpoint
# Default is 1024, 0 for unlimited
#
# queue.checkpoint.writes: 1024
#
# If using queue.type: persisted, the interval in milliseconds when a checkpoint is forced on the head page
# Default is 1000, 0 for no periodic checkpoint.
#
# queue.checkpoint.interval: 1000
#
# ------------ Dead-Letter Queue Settings --------------
# Flag to turn on dead-letter queue.
#
# dead_letter_queue.enable: false

# If using dead_letter_queue.enable: true, the maximum size of each dead letter queue. Entries
# will be dropped if they would increase the size of the dead letter queue beyond this setting.
# Deafault is 1024mb
# dead_letter_queue.max_bytes: 1024mb

# If using dead_letter_queue.enable: true, the directory path where the data files will be stored.
# Default is path.data/dead_letter_queue
#
# path.dead_letter_queue:
#
# ------------ Metrics Settings --------------
#
# Bind address for the metrics REST endpoint
#
# http.host: "127.0.0.1"
#
# Bind port for the metrics REST endpoint, this option also accept a range
# (9600-9700) and logstash will pick up the first available ports.
#
# http.port: 9600-9700
#
# ------------ Debugging Settings --------------
#
# Options for log.level:
# * fatal
# * error
# * warn
# * info (default)
# * debug
# * trace
#
 log.level: debug
path.logs: /var/log/logstash
#
# ------------ Other Settings --------------
#
# Where to find custom plugins
# path.plugins: []
path.settings: /etc/logstash
xpack.monitoring.elasticsearch.url: "http://X.X.X.X:9200"
xpack.monitoring.elasticsearch.username: XXXX
xpack.monitoring.elasticsearch.password: XXXX
```

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 24, 2017, 3:52pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/7 "2017-08-24T15:52:47Z")

</div>

The only lines that should need adding are these:

```auto
node.name: logstash
path.data: /var/lib/logstash
path.config: /etc/logstash/conf.d
path.logs: /var/log/logstash
xpack.monitoring.elasticsearch.url: "http://X.X.X.X:9200"
xpack.monitoring.elasticsearch.username: XXXXXX
xpack.monitoring.elasticsearch.password: XXXXXX

```

I note in your logstash.yml file that you have both `node.name` and `log.level` indented with a single space. YAML is indent-sensitive, as that indicates nested structures. Try removing the indents.

---

<div class="post-metadata">

### Author: ![pshah7](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pshah7](https://discuss.elastic.co/u/pshah7)
#### Post date: [August 24, 2017, 4:09pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/8 "2017-08-24T16:09:14Z")

</div>

@theuntergeek Fixed the indentations under LS.yml and restart the service. Running into below error.

xpack.monitoring.elasticsearch.url" hasn't been registered? - I have "[http://ESURL:9200](http://ESURL:9200)"

`[2017-08-24T12:05:07,316][FATAL][logstash.runner] An unexpected error occurred! {:error=>#<ArgumentError: Setting "xpack.monitoring.elasticsearch.url" hasn't been registered>, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/settings.rb:32:in`get\_setting'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:64:in `set_value'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:83:in`merge'", "org/jruby/RubyHash.java:1342:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:83:in`merge'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:135:in `validate_all'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:244:in`execute'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:209:in`run'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'", "/usr/share/logstash/lib/bootstrap/environment.rb:71:in`(root)'"]}`

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 24, 2017, 4:32pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/9 "2017-08-24T16:32:19Z")

</div>

> [@pshah7](#):
>
> Setting "xpack.monitoring.elasticsearch.url" hasn't been registered

This suggests that you have not installed the X-Pack plugin for Logstash. Did you run `bin/logstash-plugin install x-pack`?

---

<div class="post-metadata">

### Author: ![pshah7](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pshah7](https://discuss.elastic.co/u/pshah7)
#### Post date: [August 24, 2017, 4:38pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/10 "2017-08-24T16:38:32Z")

</div>

Awesome, thanks so much!

---

<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: [September 21, 2017, 4:38pm UTC](https://discuss.elastic.co/t/cannot-run-logstash-as-a-service-with-active-pipeline/98244/11 "2017-09-21T16:38:37Z")

</div>

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