diff options
author | Marius Tomaschewski <mt@suse.com> | 2012-02-20 16:29:42 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-01 14:40:41 +0100 |
commit | e31e840d5d6bf823b7129132c5582f86d3693f6c (patch) | |
tree | 7ba1eea28a1967715fb69c58e6c531752c19eeb4 | |
parent | c2970de8b0dd07c52f3a107e5ec3de55010c9999 (diff) | |
download | rsyslog-e31e840d5d6bf823b7129132c5582f86d3693f6c.tar.gz rsyslog-e31e840d5d6bf823b7129132c5582f86d3693f6c.tar.xz rsyslog-e31e840d5d6bf823b7129132c5582f86d3693f6c.zip |
Detect if to use /run/systemd/journal/syslog under systemd
Detect if we have to use the new /run/systemd/journal/syslog
socket instead of the /dev/log under newer systemd versions.
Signed-off-by: Marius Tomaschewski <mt@suse.com>
-rw-r--r-- | plugins/imuxsock/imuxsock.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index feddb20c..767f9a90 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -67,6 +67,9 @@ MODULE_TYPE_NOKEEP #define _PATH_LOG "/dev/log" #endif #endif +#ifndef SYSTEMD_PATH_LOG +#define SYSTEMD_PATH_LOG "/run/systemd/journal/syslog" +#endif /* emulate struct ucred for platforms that do not have it */ #ifndef HAVE_SCM_CREDENTIALS @@ -775,6 +778,12 @@ CODESTARTwillRun # endif if(pLogSockName != NULL) listeners[0].sockName = pLogSockName; + else if(sd_booted()) { + struct stat st; + if(stat(SYSTEMD_PATH_LOG, &st) != -1 && S_ISSOCK(st.st_mode)) { + listeners[0].sockName = SYSTEMD_PATH_LOG; + } + } if(ratelimitIntervalSysSock > 0) { if((listeners[0].ht = create_hashtable(100, hash_from_key_fn, key_equals_fn, NULL)) == NULL) { /* in this case, we simply turn of rate-limiting */ |