Setup logstash as system daemon

Can someone help me in setting up logstash as a system daemon. I have download logstash-7.9.1.tar.gz

Just extract the binaries and logstash is runnable, you might want to document yourself on how to create a systemd service.

Just google it !

I have Googled and tried to setup. It Start's the process and exit with the below error

root@dev-server:~# systemctl status logstash
● logstash.service - logstash
   Loaded: loaded (/etc/systemd/system/logstash.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-10-09 04:14:51 UTC; 4s ago
  Process: 46465 ExecStart=/app01/logstash-7.9.1/bin/logstash --path.settings /app01/logstash-7.9.1/config (code=exited, status=216/GROUP)
 Main PID: 46465 (code=exited, status=216/GROUP)

Oct 09 04:14:51 dev-server systemd[1]: Started logstash.
Oct 09 04:14:51 dev-server systemd[46465]: logstash.service: Failed to determine group credentials: No such process
Oct 09 04:14:51 dev-server systemd[46465]: logstash.service: Failed at step GROUP spawning /app01/logstash-7.9.1/bin/logstash: No such process
Oct 09 04:14:51 dev-server systemd[1]: logstash.service: Main process exited, code=exited, status=216/GROUP
Oct 09 04:14:51 dev-server systemd[1]: logstash.service: Failed with result 'exit-code'.
    root@dev-server:~# cat /etc/systemd/system/logstash.service
[Unit]
Description=logstash

[Service]
Type=simple
User=root
Group=root
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/logstash-7.9.1/bin/logstash "--path.settings" "/logstash-7.9.1/config"
#Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384

# When stopping, how long to wait before giving up and sending SIGKILL?
# Keep in mind that SIGKILL on a process can cause data loss.
TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target
1 Like

I got the fix. logstash-7.9.1 folder was under different user. I changed it root user. It started working.

Well done !

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