I am having issues with an Ubuntu 16.04.4 machine running systemd and syslog-ng (3.5.6-2.1), where messages logged to syslog by a process (let's call it X) were not received by syslog-ng. Digging into this revealed that journald was hijacking the messages logged by X, and they hence never made it to syslog-ng.
After searching around a bit, it seemed that systemd needed to be made aware that syslog-ng is providing the syslog service, such that messages received by journald made it to syslog-ng as well. Looking at the systemd unit of syslog-ng, however, revealed that this should have been the case already, as it contains:
[Install]
WantedBy=multi-user.target
Alias=syslog.service
But even though syslog-ng had been explicitly enabled with systemctl enable syslog-ng
, it seems the symlink
/etc/systemd/system/syslog.service -> /lib/systemd/system/syslog-ng.service
was missing on the system. Uninstalling and re-installing syslog-ng and then running systemctl enable syslog-ng
did in fact re-create that symlink, which made it work.
The actual problem now is that I have a machine where the syslog-ng systemd unit is enabled, but the symlink is missing, and in that case, systemctl enable syslog-ng
does not re-create the missing symlink, as systemd seems to see that syslog-ng is already enabled, and therefore doesn't bother to check whether the symlink exists or not.
Of course I could theoretically manually create the symlink, but my questions here are:
- why is the symlink missing, if systemd must have created it when enabling the syslog-ng unit?
- what is the correct way of having systemd re-create this symlink, without having to disable syslog-ng and then re-enabling it?
I have looked through the systemd documentation I could find, but it is frustratingly vague on when/how/under what circumstances these symlinks are created.
Any help would be much appreciated!