/dev/log is missing. how do I fix?

Check if you have /run/systemd/journal/dev-log; it should be a socket:

$ ls -l /run/systemd/journal/dev-log
srw-rw-rw- 1 root root 0 Dec 16 09:17 /run/systemd/journal/dev-log

If this checks out, then you can simply make a symbolic link from /dev/log to /run/systemd/journal/dev-log:

sudo ln -s /run/systemd/journal/dev-log /dev/log

For me this ended up being a problem with how the imuxsock module used in rsyslog was working with systemd.

In the imuxsock documentation they walk through how the module is supposed to work for systemd. Step 1 was where I was seeing issues:

Step 1: Select name of system socket

  1. If the user has not explicitly chosen to set SysSock.Use="off" then the default listener socket (aka, “system log socket” or simply “system socket”) name is set to /dev/log. Otherwise, if the user has explicitly set SysSock.Use="off", then rsyslog will not listen on /dev/log OR any socket defined by the SysSock.Name parameter and the rest of this section does not apply.

  2. If the user has specified sysSock.Name="/path/to/custom/socket" (and not explicitly set SysSock.Use="off"), then the default listener socket name is overwritten with /path/to/custom/socket.

  3. Otherwise, if rsyslog is running under systemd AND /run/systemd/journal/syslog exists, (AND the user has not explicitly set SysSock.Use="off") then the default listener socket name is overwritten with /run/systemd/journal/syslog.

The system should have falling into Step 3 and changing the default path to be "/run/systemd/journal/syslog" but instead it was remaining "/var/log". This meant that the imuxsock module would try (and succeed sometimes) to create a socket at /dev/log where there should instead be symbolic link created by the systemd-journald-dev-log.socket. In the case that it would fail to create the real socket, the symbolic link would still be removed.

That documentation was the outcome of this issue reported on the rsyslog github. If you want to skip the discussion and jump straight to the changes see PR#1 and PR#2 respectively.

My solution was to just configure the imuxsock module to use the systemd path in my /etc/rsyslog.conf:

module(load="imuxsock"
    SysSock.Name="/run/systemd/journal/syslog")

This seems to have fixed my issue and sounds like a good solution here since it would explain why the symbolic link might disappear again after you would manually create it.

If you look on your system and "/run/systemd/journal/syslog" is not present look at the "syslog.socket" to see if it is starting successfully as that is what is responsible for creating the socket.

systemctl status syslog.socket

It could be that your version of rsyslog.service doesn't define syslog.service as an alias which is needed as the syslog.socket tries to active that service.

For what it is worth I am running on an embedded version of Linux so it isn't a perfect replication of the problem here, but it seemed relevant enough to share.