You are not logged in.

#1 2016-12-09 01:19:48

Bachsau
Member
Registered: 2016-12-09
Posts: 16

[Solved] Journald's syslog socket is missing

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

#2 2016-12-09 18:14:57

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [Solved] Journald's syslog socket is missing

What's the output of

ls -lR /run/systemd

Offline

#3 2016-12-10 04:39:58

Bachsau
Member
Registered: 2016-12-09
Posts: 16

Re: [Solved] Journald's syslog socket is missing

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. smile

Last edited by Bachsau (2016-12-10 06:02:50)

Offline

#4 2016-12-10 12:45:44

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [Solved] Journald's syslog socket is missing

Great job! Can you please mark the thread as solved by editing your first post and prepending [solved] to the title.

Offline

Board footer

Powered by FluxBB