elastic / elastic/logstash

Logstash doesn't stay running when re/started via Rundeck

Open
#4,959 2 comments 0 reactions 0 assignees View on GitHub
packaging
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

I've had a problem since the 1.3 and now with 2.2 version of logstash where restarting logstash via Rundeck (via ssh) causes the logstash process to die when I log out of the host.

I'm not sure if this has something to do with how the stderr/stdout file handles are redirected, or perhaps the exec and backgrounding of the process.. or maybe even if Rundeck via ssh uses a non-interactive shell..

In the past I've monkey-patched the init script to prepend a nohup and this has fixed the issue for me.

old fix i used:

```
sed -i -c -e 's/^ \$JAVA \$ARGS.*$/ nohup \$JAVA \$ARGS > \/dev\/null 2>\&1 \&/g' /etc/init.d/logstash
```

The new start looks like this (which leaves logstash stopped on logout):

```
# Run the program!
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP $EXTRA_GROUPS / sh -c "
cd $LS_HOME
ulimit -n ${LS_OPEN_FILES}
nohup exec \"$program\" $args
" > "${LS_LOG_DIR}/$name.stdout" 2> "${LS_LOG_DIR}/$name.err" &
```

Would it make sense to completely rewrite this using sysv init basic functions (ex: daemon, etc)?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.