代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/rsyslog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 27ee1b988a465e5f89e8a9234f4a01c34cab4387 Mon Sep 17 00:00:00 2001
From: wangshouping <wangshouping@huawei.com>
Date: Mon, 27 Apr 2020 08:53:18 -0400
Subject: [PATCH] print main queue info to journal when receive USR1 signal
Signed-off-by: wangshouping <wangshouping@huawei.com>
V-2: add macro control for systemd/sd-journal.h
Signed-off-by: pengyi37 <pengyi37@huawei.com>
V-3: adapt pMsgQueue to runConf->pMsgQueue
Signed-off-by: pengyi37 <pengyi37@huawei.com>
---
tools/rsyslogd.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
index 31b91a1..8be2032 100644
--- a/tools/rsyslogd.c
+++ b/tools/rsyslogd.c
@@ -36,6 +36,7 @@
#endif
#ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-daemon.h>
+# include <systemd/sd-journal.h>
#endif
#include "rsyslog.h"
@@ -182,6 +183,7 @@ static pthread_mutex_t mutChildDied;
static int bChildDied = 0;
static pthread_mutex_t mutHadHUP;
static int bHadHUP;
+static int g_bRecordQueue;
static int doFork = 1; /* fork - run in daemon mode - read-only after startup */
int bFinished = 0; /* used by termination signal handler, read-only except there
* is either 0 or the number of the signal that requested the
@@ -1294,8 +1296,13 @@ rsyslogdDebugSwitch(void)
dbgprintf("\n");
debugging_on = 0;
}
+
}
+static void RsyslogdDebugQueue(void)
+{
+ g_bRecordQueue = 1;
+}
/* This is the main entry point into rsyslogd. Over time, we should try to
* modularize it a bit more...
@@ -1629,7 +1636,7 @@ initAll(int argc, char **argv)
hdlr_enable(SIGINT, rsyslogdDoDie);
hdlr_enable(SIGQUIT, rsyslogdDoDie);
} else {
- hdlr_enable(SIGUSR1, SIG_IGN);
+ hdlr_enable(SIGUSR1, RsyslogdDebugQueue);
hdlr_enable(SIGINT, SIG_IGN);
hdlr_enable(SIGQUIT, SIG_IGN);
}
@@ -1997,6 +2004,15 @@ mainloop(void)
if(need_free_mutex) {
pthread_mutex_unlock(&mutHadHUP);
}
+ if (g_bRecordQueue) {
+ if(runConf->pMsgQueue != NULL) {
+ sd_journal_print(LOG_NOTICE, "main queue size information: current QueueSize=%d MaxQueueSize=%d\n",
+ runConf->pMsgQueue->iQueueSize, runConf->pMsgQueue->iMaxQueueSize);
+ } else {
+ sd_journal_print(LOG_NOTICE, "main queue size information: pMsgQueue is NULL!\n");
+ }
+ g_bRecordQueue = 0;
+ }
processImInternal();
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。