I should clarify I'm on amazon linux 2 with systemd 219-57

Ronald Fenner
Network Architect
Game Circus LLC.


On May 16, 2019, at 2:57 PM, Evan Rempel <erempel@uvic.ca> wrote:

That seems quite odd to me. We have been running under Redhat 7 for quite some time (hundreds of systems) with a Type=notify
and the -F flag.

● syslog-ng.service - System Logger Daemon
   Loaded: loaded (/usr/lib/systemd/system/syslog-ng.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-05-13 14:43:24 PDT; 2 days ago
     Docs: man:syslog-ng(8)
 Main PID: 48953 (syslog-ng)
   CGroup: /system.slice/syslog-ng.service
           └─48953 /usr/sbin/syslog-ng -F -p /var/run/syslogd.pid

This uses the service file that is part of the copr RPMs from the syslog-ng maintainers

$ rpm -ql syslog-ng | grep service
/usr/lib/systemd/system/syslog-ng.service

[Unit]
Description=System Logger Daemon
Documentation=man:syslog-ng(8)
Wants=network.target network-online.target
After=network.target network-online.target

[Service]
Type=notify
ExecStart=/usr/sbin/syslog-ng -F $SYSLOGNG_OPTS -p /var/run/syslogd.pid
ExecReload=/bin/kill -HUP $MAINPID
EnvironmentFile=-/etc/default/syslog-ng
EnvironmentFile=-/etc/sysconfig/syslog-ng
StandardOutput=journal
StandardError=journal
Restart=on-failure

[Install]
WantedBy=multi-user.target



Oh well. I'm glad you got it running and are happy.

Evan.

On 5/16/19 12:46 PM, Ronald Fenner wrote:
Here's the config I came up with that works. The biggest change is that type should be forking. Notify requires the service to signal back to systemd that the process has finished starting up which syslog-ng doesn't do and thus ends up timing out.
Tje -F flag actually blocked the start command when I ran systemctl start syslog-ng.

Since syslog-ng apparently forks over to the supervising process the correct type is forking as the service's exec start is expected to exit immediately after execution with the child process running the service.

Looking at the status for the service show both the supervising and actual process.


● syslog-ng.service - System Logger Daemon
   Loaded: loaded (/etc/systemd/system/syslog-ng.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-05-16 19:26:08 UTC; 14s ago
     Docs: man:syslog-ng(8)
  Process: 12591 ExecStart=/opt/syslog-ng/sbin/syslog-ng $SYSLOGNG_OPTIONS --cfgfile $SYSLOGNG_CONF_FILE --control $SYSLOGNG_CONTROL_FILE --persist-file $SYSLOGNG_PERSIST_FILE --pidfile $SYSLOGNG_PID_FILE (code=exited, status=0/SUCCESS)
 Main PID: 12592 (syslog-ng)
   CGroup: /system.slice/syslog-ng.service
           ├─12592 supervising syslog-ng
           └─12593 /opt/syslog-ng/sbin/syslog-ng --no-caps --cfgfile /opt/syslog-ng/etc/syslog-ng.conf --control /opt/syslog-ng/var//syslog-ng.ctl --persist-file /opt/syslog-ng/var//syslog-ng.persist --pidfile /var/run/...

May 16 19:26:08 ip-172-30-6-133.ec2.internal systemd[1]: Starting System Logger Daemon...
May 16 19:26:08 ip-172-30-6-133.ec2.internal systemd[1]: Started System Logger Daemon.


syslog-ng.service
[Unit]
Description=System Logger Daemon
Documentation=man:syslog-ng(8)
Wants=network.target network-online.target
After=network.target network-online.target

[Service]
Type=forking
Environment=SYSLOGNG_PID_FILE="/var/run/syslog-ng.pid"
Environment=SYSLOGNG_CONF_FILE="/opt/syslog-ng/etc/syslog-ng.conf"
Environment=SYSLOGNG_PERSIST_FILE="/opt/syslog-ng/var//syslog-ng.persist"
Environment=SYSLOGNG_CONTROL_FILE="/opt/syslog-ng/var//syslog-ng.ctl"
Environment=SYSLOGNG_OPTIONS="--no-caps"
ExecStart=/opt/syslog-ng/sbin/syslog-ng $SYSLOGNG_OPTIONS --cfgfile $SYSLOGNG_CONF_FILE --control $SYSLOGNG_CONTROL_FILE --persist-file $SYSLOGNG_PERSIST_FILE --pidfile $SYSLOGNG_PID_FILE
ExecReload=/bin/kill -HUP $MAINPID
StandardOutput=journal
StandardError=journal
Restart=on-failure
Environment=LD_LIBRARY_PATH=/usr/lib/jvm/jre-1.8.0/lib/amd64/server:$LD_LIBRARY_PATH

[Install]
WantedBy=multi-user.target



Hope this helps anyone else in the future
Ronald Fenner
Network Architect
Game Circus LLC.

rfenner@gamecircus.com

On May 16, 2019, at 1:07 PM, Ronald Fenner <rfenner@gamecircus.com> wrote:

Thanks I'll look through that and see what changes I may need to make.

I may have found the problem but I'm still waiting on a build to finish is that my java command was broken when I check to see if I could see some of the Kafka streams to confirm it could access the cluster.

I had based mine on the service file listed in GitHub for rhel package and on one that and one I worked up for consul.

Ronald Fenner
Network Architect
Game Circus LLC.

rfenner@gamecircus.com

On May 16, 2019, at 11:30 AM, Evan Rempel <erempel@uvic.ca> wrote:

I think you are just missing the forground flag (-F) in the ExecStart command

You can see a discussion of the systemd service unit file at

https://github.com/balabit/syslog-ng/issues/2667

and a proposed service file.

On 5/16/19 8:27 AM, Ronald Fenner wrote:
I'm trying to switch from an init.d script to a system service and having problems getting the service to run.
The syslog-ng service gets timed out and never starts up.

My service looks like this:
[Unit]
Description="Syslog-ng an enhanced syslog"
Documentation=man:syslog-ng(8)
After=network.target
ConditionFileNotEmpty=/opt/syslog-ng/etc/syslog-ng.conf

[Service]
Type=notify
ExecStart=/opt/syslog-ng/sbin/syslog-ng --no-caps -p /var/run/syslogd.pid -rdvt
ExecReload=/bin/kill -HUP $MAINPID
StandardOutput=journal
StandardError=journal
Restart=on-failure
Environment=LD_LIBRARY_PATH=/usr/lib/jvm/java/jre/lib/amd64/server:$LD_LIBRARY_PATH

[Install]
WantedBy=multi-user.target

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq