# Weird Filebeat init script issue

**URL:** <https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 24, 2015, 8:55pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486 "2015-11-24T20:55:08Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![DanG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dang/32/6175_2.png) [@DanG](https://discuss.elastic.co/u/DanG)\
**Post date:** [January 22, 2016, 8:01pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/21 "2016-01-22T20:01:35Z")

</div>

The following fixed it for me - change line 61 in /etc/init.d/filebeat

from:  
`--exec $WRAPPER -- $WRAPPER_ARGS -- $DAEMON $DAEMON_ARGS \`  
to:  
`--exec $WRAPPER -- $WRAPPER_ARGS -- $DAEMON -- $DAEMON_ARGS \`

---

<div class="post-metadata">

**Author:** ![DanG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dang/32/6175_2.png) [@DanG](https://discuss.elastic.co/u/DanG)\
**Post date:** [January 22, 2016, 10:33pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/23 "2016-01-22T22:33:40Z")

</div>

I resorted to this:

```
'su -m -c "service {{beat}} restart"':
  cmd.run:
    - use_vt: true
```

---

<div class="post-metadata">

**Author:** ![DanG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dang/32/6175_2.png) [@DanG](https://discuss.elastic.co/u/DanG)\
**Post date:** [January 22, 2016, 10:34pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/24 "2016-01-22T22:34:18Z")

</div>

I bet it has to do with a env variable... perhaps TERM

---

<div class="post-metadata">

**Author:** ![veve90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veve90/32/6517_2.png) [@veve90](https://discuss.elastic.co/u/veve90)\
**Post date:** [February 16, 2016, 9:20am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/25 "2016-02-16T09:20:54Z")

</div>

> [@jderieg](#):
>
> sudo service filebeat start \> /dev/null 2\>&1 &

I tried the solution but it didn't worked for me...

---

<div class="post-metadata">

**Author:** ![veve90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veve90/32/6517_2.png) [@veve90](https://discuss.elastic.co/u/veve90)\
**Post date:** [February 16, 2016, 9:31am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/26 "2016-02-16T09:31:49Z")

</div>

@DanG what is the filebeat version that you are using? I don't have the same thing on line 61..

In addition the startup command that I have is

`daemon $daemonopts $wrapper $wrapperopts -- $agent $args`

---

<div class="post-metadata">

**Author:** ![centromere](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@centromere](https://discuss.elastic.co/u/centromere)\
**Post date:** [February 21, 2016, 12:21pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/27 "2016-02-21T12:21:48Z")

</div>

I too am having this issue with Salt on Ubuntu 14.04. I have discovered a workaround. On line 61 of the init script, replace:

```
--exec $WRAPPER -- $WRAPPER_ARGS -- $DAEMON $DAEMON_ARGS \

```

with:

```
-b --exec $WRAPPER -- $WRAPPER_ARGS -- $DAEMON $DAEMON_ARGS \
```

---

<div class="post-metadata">

**Author:** ![DanG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dang/32/6175_2.png) [@DanG](https://discuss.elastic.co/u/DanG)\
**Post date:** [February 24, 2016, 4:54pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/28 "2016-02-24T16:54:46Z")

</div>

filebeat 1.0.1 from the ubuntu/debian package which is where I think you are seeing a differenc.e

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [February 24, 2016, 7:13pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/29 "2016-02-24T19:13:30Z")

</div>

You might want to upgrade to filebeat 1.1.1. The 1.1.1 release fixes a critical bug for logstash output possibly hanging.

---

<div class="post-metadata">

**Author:** ![frooop](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@frooop](https://discuss.elastic.co/u/frooop)\
**Post date:** [March 2, 2016, 8:47am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/30 "2016-03-02T08:47:46Z")

</div>

This seems to work for me. Thanks!

---

<div class="post-metadata">

**Author:** ![sniffer32](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@sniffer32](https://discuss.elastic.co/u/sniffer32)\
**Post date:** [March 30, 2016, 9:59am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/31 "2016-03-30T09:59:00Z")

</div>

I found a wrong argument in start-stop-daemon args that causes the init script to hang in some chases (like starting through salt or over remote ssh).  
The start-stop-daemon argument "-n" requires an input but it is missing.

the following line must be changed in /etc/init.d/filebeat to fix the problem:

- WRAPPER\_ARGS="-r / -n -p $PIDFILE"

- WRAPPER\_ARGS="-r / -p $PIDFILE"

---

<div class="post-metadata">

**Author:** ![cybacolt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cybacolt/32/6485_2.png) [@cybacolt](https://discuss.elastic.co/u/cybacolt)\
**Post date:** [March 31, 2016, 4:31am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/32 "2016-03-31T04:31:32Z")

</div>

has anyone raised this as an issue to be fixed?

---

<div class="post-metadata">

**Author:** ![tudor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tudor/32/3753_2.png) [@tudor](https://discuss.elastic.co/u/tudor)\
**Post date:** [March 31, 2016, 12:44pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/33 "2016-03-31T12:44:28Z")

</div>

The `WRAPPER_ARGS` are passed to the `*beat-god` program, not to `start-stop-daemon`. The `-n` for `go-daemon` means `nohup`.

This is the go-daemon that I'm talking about: [https://github.com/fiorix/go-daemon](https://github.com/fiorix/go-daemon)

And this ticket seems related to the issue here: [https://github.com/fiorix/go-daemon/issues/5](https://github.com/fiorix/go-daemon/issues/5) Unfortunately no hints about what could cause it.

---

<div class="post-metadata">

**Author:** ![tudor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tudor/32/3753_2.png) [@tudor](https://discuss.elastic.co/u/tudor)\
**Post date:** [March 31, 2016, 12:56pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/34 "2016-03-31T12:56:50Z")

</div>

I'll check if I can find a solution, because on CentOS systems we need go-daemon. But on debian, where we have `start-stop-daemon`, `go-daemon` does the same thing so we could get rid of it.

---

<div class="post-metadata">

**Author:** ![Tecon](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tecon](https://discuss.elastic.co/u/Tecon)\
**Post date:** [May 10, 2016, 10:36am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/35 "2016-05-10T10:36:46Z")

</div>

Have you modified the config file of filebeat which is located at /etc/filebeat/filebeat.yml default?  
If you have modified the filebeat.yml to make the output to stdout or make stdin tobe the input,problem happens of course for systemd is a deamon process.

---

<div class="post-metadata">

**Author:** ![flow\_state](https://avatars.discourse-cdn.com/v4/letter/f/2bfe46/32.png) [@flow\_state](https://discuss.elastic.co/u/flow_state)\
**Post date:** [June 1, 2016, 6:47pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/36 "2016-06-01T18:47:54Z")

</div>

This is still an issue. Running the newest Amazon Linux, it is impossible to start filebeat remotely. Does anyone have an idea of how to deal with this? It's a bit disturbing that the last comment was months ago...

I'm happy to experiment further with this, but have no idea where to go next.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [June 2, 2016, 7:09am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/37 "2016-06-02T07:09:22Z")

</div>

@flow_state which version of filebeat are you using?

---

<div class="post-metadata">

**Author:** ![ptrlv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ptrlv/32/8773_2.png) [@ptrlv](https://discuss.elastic.co/u/ptrlv)\
**Post date:** [June 24, 2016, 2:03pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/38 "2016-06-24T14:03:05Z")

</div>

Is there a fix on this for CentOS6 and filebeat-1.2.3 ?

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [June 27, 2016, 9:58am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/39 "2016-06-27T09:58:34Z")

</div>

I think it has been fixed by forking go-deamon and correctly closing file-descriptors when demonizing. See [filebeat 1.2.2 release notes](https://www.elastic.co/guide/en/beats/libbeat/current/release-notes-1.2.2.html)

---

<div class="post-metadata">

**Author:** ![eleinat2](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@eleinat2](https://discuss.elastic.co/u/eleinat2)\
**Post date:** [May 13, 2017, 6:39am UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/40 "2017-05-13T06:39:09Z")

</div>

Thanks for responses. Worked perfectly.

[![](https://discuss-assets.s3.amazonaws.com/original/3X/d/0/d04329105596bb49fb991c9bf2e3f70cec4e2778.png)](https://www.clippp.com/)

---

<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 5, 2017, 9:49pm UTC](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486/41 "2017-07-05T21:49:33Z")

</div>



[Previous page](https://discuss.elastic.co/t/weird-filebeat-init-script-issue/35486.md?page=1)
