I install logstash-5.2.0.tar.gz and wanna start logstash as a background service using script.
My command in the script is 'bin/logstash -f test.conf &'. But it is also not in background and 'agent' not is included in this version.
How do I exec the logstash as the daemon?
What operating system and version are you using?
I uses centOs 6.4.
If you use the RPM you get the service files included.
is there other command instead of using rpm?
You'd need to build the service file(s) yourself.
I made the script file in the /etc/init.d/.
start(){
if [ -z $PID ]
then
$LOGSTASH -f $CONF_FILE > $LOG 2> /dev/null &
echo "logstash start"
else
echo "logstash is already running (pid $PID)"
fi
}
I started this service but it also had logstash's log.
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
.
Ok. Thank you for detail answer!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.