Logstash run as a background service

Don't make your own. Logstash can auto-detect the system type and install a script accordingly, or it can be coerced into installing SysV. For CentOS 6.4, the auto-detected startup type would be upstart, so you could start/stop logstash with initctl.

Step 1, edit startup.options, logstash.yml, and jvm.options found in $LS_HOME/config/
Step 2, As root, or with sudo, run:

$LS_HOME/bin/system-install $LS_HOME/config/startup.options

for auto-detected system type, or optionally coerce sysv by appending it like this,

$LS_HOME/bin/system-install $LS_HOME/config/startup.options sysv

Be sure to either export $LS_HOME or substitute the path where you extracted the tarball. You may also need to export JAVA_HOME before running system-install.

5 Likes