[syslog-ng] Systemd service times out for syslog-ng 3.16.1
Ronald Fenner
rfenner at gamecircus.com
Thu May 16 19:46:28 UTC 2019
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 at gamecircus.com
> On May 16, 2019, at 1:07 PM, Ronald Fenner <rfenner at 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 at gamecircus.com
>
>> On May 16, 2019, at 11:30 AM, Evan Rempel <erempel at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20190516/4dd77cf7/attachment.html>
More information about the syslog-ng
mailing list