You are not logged in.
Hi! I just read the documentation about journald and syslog and how to get them work together. It says there should be a socket named /run/systemd/journal/syslog, but it does not exist. I thought it might appear after enabling ForwardToSyslog setting and restarting journald, but it does not.
Btw, I know there are ways to make syslog-ng get its data from the journals, but that's not the question here. The question is: Where's my socket?
Last edited by Bachsau (2016-12-10 15:41:04)
Offline
What's the output of
ls -lR /run/systemd
Offline
Yay! I finally got it working!
I found out that the socket needs to be pulled in by the syslog service itself. This did not happen as the default configuration for syslog-ng is to read from the journals.
First of all I did a
grep -r "syslog" /usr/lib/systemd/system
to find out if there's something mentioning that socket and found a file called "syslog.socket". The last line of that file contained a valueable hint: "See http://www.freedesktop.org/wiki/Software/systemd/syslog for details."
So I head over to that address which tells exactly how to modify the unit file to make it work. First of all, I made a copy of /usr/lib/systemd/system/syslog-ng in /etc/systemd/system and added "Alias=syslog.service" to the Install-section, then set StandardOutput and StandardError to null, and, most important, added "Requires=syslog.socket" to the Unit-section. This is what makes the socket appear.
My final service file looks like this:
[Unit]
Description=System Logger Daemon
Documentation=man:syslog-ng(8)
Requires=syslog.socket
[Service]
Type=notify
ExecStart=/usr/bin/syslog-ng -F
ExecReload=/usr/bin/kill -HUP $MAINPID
StandardOutput=null
StandardError=null
Restart=on-failure
[Install]
WantedBy=multi-user.target
Alias=syslog.service
After that I enabled the service with
systemctl enable syslog-ng
, which created all the required symlinks.
syslog-ng's source configuration in /etc/syslog-ng/syslog-ng.conf needs to be set to
source src {
systemd-syslog();
file("/proc/kmsg" program-override("kernel") flags(kernel));
internal();
};
After a reboot everything works.
Last edited by Bachsau (2016-12-10 06:02:50)
Offline
Great job! Can you please mark the thread as solved by editing your first post and prepending [solved] to the title.
Offline