Gergely Nagy <algernon@balabit.hu> writes:
When the journal was introduced in systemd, it started to pass /run/systemd/journal/syslog to syslogds (it was passing down /dev/log before). Since we verify that the FD to open matches the expected filename, we didn't pick up the fd due to the filename mismatch.
This can be fixed on the system() source level, where it can decide which to generate into the config. However, for setups that do not use system() for one reason or the other, this does not work.
For them, the best solution is to try and check the passed FDs with /run/systemd/journal/syslog as the filename, so if all else fails, we pick that up. This patch does just that.
A small note:
+static gboolean +afunix_sd_acquire_socket(AFSocketSourceDriver *s, gint *result_fd) +{ + AFUnixSourceDriver *self = (AFUnixSourceDriver *) s; + int status; + + status = afunix_sd_acquire_socket_with_fn(s, result_fd, self->filename); + if (status == 0) { - msg_debug("Failed to acquire systemd socket, trying to open ourselves", - evt_tag_str("filename", self->filename), - NULL); + status = afunix_sd_acquire_socket_with_fn(s, result_fd, "/run/systemd/journal/syslog"); + if (status == 1) + { + g_free(self->filename); + self->filename = g_strdup("/run/systemd/journal/syslog"); + return TRUE; + } } - return TRUE; + return !!(status == 1); }
This part should not blindly call _acquire_socket_with_fn with the filename replaced, but only do that when the current self->filename is /dev/log, otherwise we might end up replacing another unix-dgram. With an extra strcmp(), the result should be safe. A bit of cleaning up around the msg_debugs() will still be in order, though. I'll try to do both tomorrow, and send an updated patch. -- |8]