The correct way to run syslog-ng as a non root user
cat /etc/default/syslog-ng@default
CONFIG_FILE=/etc/syslog-ng/syslog-ng.conf
PERSIST_FILE=/var/lib/syslog-ng/syslog-ng.persist
CONTROL_FILE=/var/lib/syslog-ng/syslog-ng.ctl
PID_FILE=/run/syslog-ng.pid
OTHER_OPTIONS="-u syslog -g syslog"
cat /usr/local/bin/syslog-pid
#!/usr/bin/bash
if [ ! -e /run/syslog-ng.pid ]
then
touch /run/syslog-ng.pid
fi
chown syslog /run/syslog-ng.pid
chmod 0664 /run/syslog-ng.pid
cat /etc/systemd/system/syslog-ng@default.service [Unit] Description=System Logger Daemon “%i” instance Documentation=man:syslog-ng(8) Conflicts=emergency.service emergency.target Wants=network.target network-online.target After=network.target network-online.target[Service]
[Install] WantedBy=multi-user.target
Type=notify
EnvironmentFile=-/etc/default/syslog-ng@%i
EnvironmentFile=-/etc/sysconfig/syslog-ng@%i
ExecStartPre=/usr/local/bin/syslog-pid
ExecStart=/usr/bin/syslog-ng -F $OTHER_OPTIONS —cfgfile $CONFIG_FILE —control $CONTROL_FILE —persist-file $PERSIST_FILE —pidfile $PID_FILE
ExecReload=/usr/bin/kill -HUP $MAINPID
StandardOutput=journal
StandardError=journal
Restart=on-failure
Don’t place the stuff to make the syslog-ng.pid in the EnvironmentFile, a EnvironmentFile is not a script file, so the instructions I found on Google are wrong, but they were using a different distro.