summaryrefslogtreecommitdiffstats
path: root/plugins/imuxsock
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-03-01 15:07:01 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-03-01 15:07:01 +0100
commit2b2e3e224c8e1648961f8110cb3b3914192e8ea6 (patch)
treece7f661e723506b2209b667d1e1f63afa1b5bddb /plugins/imuxsock
parent16811e2f38133c47a870382b878fc9099dbb2859 (diff)
parent0bdeeb3c540a0e8e2946119163f9c2a3e0de9cfd (diff)
downloadrsyslog-2b2e3e224c8e1648961f8110cb3b3914192e8ea6.tar.gz
rsyslog-2b2e3e224c8e1648961f8110cb3b3914192e8ea6.tar.xz
rsyslog-2b2e3e224c8e1648961f8110cb3b3914192e8ea6.zip
Merge branch 'v6-stable'
Conflicts: plugins/imuxsock/imuxsock.c
Diffstat (limited to 'plugins/imuxsock')
-rw-r--r--plugins/imuxsock/imuxsock.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 3e477ea0..8b546bdd 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -69,6 +69,9 @@ MODULE_CNFNAME("imuxsock")
#define _PATH_LOG "/dev/log"
#endif
#endif
+#ifndef SYSTEMD_PATH_LOG
+#define SYSTEMD_PATH_LOG "/run/systemd/journal/syslog"
+#endif
/* forward definitions */
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal);
@@ -1143,6 +1146,71 @@ ENDrunInput
BEGINwillRun
CODESTARTwillRun
+<<<<<<< HEAD
+=======
+ register int i;
+ int actSocks;
+
+ /* first apply some config settings */
+# ifdef OS_SOLARIS
+ /* under solaris, we must NEVER process the local log socket, because
+ * it is implemented there differently. If we used it, we would actually
+ * delete it and render the system partly unusable. So don't do that.
+ * rgerhards, 2010-03-26
+ */
+ startIndexUxLocalSockets = 1;
+# else
+ startIndexUxLocalSockets = bOmitLocalLogging ? 1 : 0;
+# 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 */
+ dbgprintf("imuxsock: turning off rate limiting because we could not "
+ "create hash table\n");
+ ratelimitIntervalSysSock = 0;
+ }
+ }
+ listeners[0].ratelimitInterval = ratelimitIntervalSysSock;
+ listeners[0].ratelimitBurst = ratelimitBurstSysSock;
+ listeners[0].ratelimitSev = ratelimitSeveritySysSock;
+ listeners[0].bUseCreds = (bWritePidSysSock || ratelimitIntervalSysSock) ? 1 : 0;
+ listeners[0].bWritePid = bWritePidSysSock;
+
+ sd_fds = sd_listen_fds(0);
+ if (sd_fds < 0) {
+ errmsg.LogError(-sd_fds, NO_ERRCODE, "imuxsock: Failed to acquire systemd socket");
+ ABORT_FINALIZE(RS_RET_ERR_CRE_AFUX);
+ }
+
+ /* initialize and return if will run or not */
+ actSocks = 0;
+ for (i = startIndexUxLocalSockets ; i < nfd ; i++) {
+ if(openLogSocket(&(listeners[i])) == RS_RET_OK) {
+ ++actSocks;
+ dbgprintf("imuxsock: Opened UNIX socket '%s' (fd %d).\n", listeners[i].sockName, listeners[i].fd);
+ }
+ }
+
+ if(actSocks == 0) {
+ errmsg.LogError(0, NO_ERRCODE, "imuxsock does not run because we could not aquire any socket\n");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+ /* we need to create the inputName property (only once during our lifetime) */
+ CHKiRet(prop.Construct(&pInputName));
+ CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("imuxsock"), sizeof("imuxsock") - 1));
+ CHKiRet(prop.ConstructFinalize(pInputName));
+
+finalize_it:
+>>>>>>> 0bdeeb3c540a0e8e2946119163f9c2a3e0de9cfd
ENDwillRun