!149 update to 8.2312.0

From: @sun_hai_10 
Reviewed-by: @yanan-rock 
Signed-off-by: @yanan-rock
This commit is contained in:
openeuler-ci-bot 2024-02-19 02:11:32 +00:00 committed by Gitee
commit d8eff7129d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 68 additions and 552 deletions

View File

@ -1,54 +0,0 @@
From 0f06a850ced79244774734ed525b289f2930d9c7 Mon Sep 17 00:00:00 2001
From: Andre lorbach <alorbach@adiscon.com>
Date: Thu, 11 May 2023 16:49:11 +0200
Subject: [PATCH] [backport] GNUTls Driver: Fix memory leaks in gtlsInitCred
Missing CA Certificate or multiple Connections caused
a memory leak in pThis->xcred as it was allocated each time in
gtlsInitCred by gnutls_certificate_allocate_credentials
closes: https://github.com/rsyslog/rsyslog/issues/5135
---
Conflict:NA
Type:bugfix
Reference:https://github.com/rsyslog/rsyslog/commit/3401d687d2d5f9556165b53be79fbe4dc49b8c79
---
---
runtime/nsd_gtls.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index e003d85d3..91cffb500 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -711,7 +711,10 @@ gtlsInitCred(nsd_gtls_t *const pThis )
DEFiRet;
/* X509 stuff */
- CHKgnutls(gnutls_certificate_allocate_credentials(&pThis->xcred));
+ if (pThis->xcred == NULL) {
+ /* Allocate only ONCE */
+ CHKgnutls(gnutls_certificate_allocate_credentials(&pThis->xcred));
+ }
/* sets the trusted cas file */
cafile = (pThis->pszCAFile == NULL) ? glbl.GetDfltNetstrmDrvrCAF(runConf) : pThis->pszCAFile;
@@ -2277,7 +2280,12 @@ finalize_it:
if(pThis->bHaveSess) {
gnutls_deinit(pThis->sess);
pThis->bHaveSess = 0;
+ /* Free memory using gnutls api first*/
+ gnutls_certificate_free_credentials(pThis->xcred);
pThis->xcred = NULL;
+ /* Free other memory */
+ free(pThis->pszConnectHost);
+ pThis->pszConnectHost = NULL;
}
}
--
2.33.0

View File

@ -1,57 +0,0 @@
From 1807410d18519520ed813dd4b9d2b2d34e583415 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Sun, 30 Oct 2022 18:43:26 +0100
Subject: [PATCH] [backport] bugfix: prevent pot. segfault when switchung to
queue emergency mode
When switching to Disk queue emergency mode, we destructed the in-memory
queue object. Practice has shown that this MAY cause races during
destruction which themselfs can lead to segfault. For that reason, we
now keep the disk queueu object. This will keep some ressources,
including disk space, allocated. But we prefer that over a segfault.
After all, it only happens after a serious queue error when we are
already at the edge of hard problems.
see also: https://github.com/rsyslog/rsyslog/issues/4963
---
Conflict:NA
Type:bugfix
Reference:https://github.com/rsyslog/rsyslog/commit/eaac48d0d23afe0146454cd9f5004ddcb47cc81b
---
---
runtime/queue.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/runtime/queue.c b/runtime/queue.c
index b3fdd5101..856b4df25 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -794,8 +794,12 @@ static rsRetVal qDelLinkedList(qqueue_t *pThis)
/* The following function is used to "save" ourself from being killed by
* a fatally failed disk queue. A fatal failure is, for example, if no
* data can be read or written. In that case, the disk support is disabled,
- * with all on-disk structures kept as-is as much as possible. Instead, the
- * queue is switched to direct mode, so that at least
+ * with all on-disk structures kept as-is as much as possible. However,
+ * we do not really stop or destruct the in-memory disk queue object.
+ * Practice has shown that this may cause races during destruction which
+ * themselfs can lead to segfault. So we prefer to was some ressources by
+ * keeping the queue active.
+ * Instead, the queue is switched to direct mode, so that at least
* some processing can happen. Of course, this may still have lots of
* undesired side-effects, but is probably better than aborting the
* syslogd. Note that this function *must* succeed in one way or another, as
@@ -808,7 +812,6 @@ queueSwitchToEmergencyMode(qqueue_t *pThis, rsRetVal initiatingError)
{
pThis->iQueueSize = 0;
pThis->nLogDeq = 0;
- qDestructDisk(pThis); /* free disk structures */
pThis->qType = QUEUETYPE_DIRECT;
pThis->qConstruct = qConstructDirect;
--
2.12.3

View File

@ -1,45 +0,0 @@
From e2beca531157a4c0a27bcdda689bc53373e305b3 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Thu, 20 Oct 2022 18:08:11 +0200
Subject: [PATCH] core bugfix: local hostname invalid if no global() config
object given
The local hostname is invalidly set to "[localhost]" on rsyslog startup
if no global() config object is present in rsyslog.conf. Sending a HUP
corrects the hostname.
This is a regression from ba00a9f25293f
closes https://github.com/rsyslog/rsyslog/issues/4975,
closes https://github.com/rsyslog/rsyslog/issues/4825From cfe12d3df739adc6e583e3d4dd798f492b0aa17e Mon Sep 17 00:00:00 2001
Conflict:NA
Reference:https://github.com/rsyslog/rsyslog/commit/e2beca531157a4c0a27bcdda689bc53373e305b3
---
runtime/glbl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/glbl.c b/runtime/glbl.c
index ff11419..71c3989 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -1567,6 +1567,7 @@ glblDoneLoadCnf(void)
stddbg = -1;
}
+finalize_it:
/* we have now read the config. We need to query the local host name now
* as it was set by the config.
*
@@ -1575,8 +1576,7 @@ glblDoneLoadCnf(void)
* are taken from that queue, the hostname will be adapted.
*/
queryLocalHostname();
-
-finalize_it: RETiRet;
+ RETiRet;
}
--
2.27.0

View File

@ -1,66 +0,0 @@
From 246b8d8553b6880146d6c489a28cf4bacea8a199 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Fri, 30 Dec 2022 17:13:17 +0100
Subject: [PATCH] core bugfix: template system may generate invalid json
When
- a list template
- is created with option.jsonf="on"
- and the last list element is a property with onEmpty="skip"
- and that property is actually empty
invalid JSON is generated.
The JSON string in this case ends with ", " instead of "}\n". This
patch fixes the issue.
closes https://github.com/rsyslog/rsyslog/issues/5050
---
Conflict:NA
Reference:https://github.com/rsyslog/rsyslog/commit/246b8d8553b6880146d6c489a28cf4bacea8a199
---
template.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/template.c b/template.c
index 21d8b8d..18bcda7 100644
--- a/template.c
+++ b/template.c
@@ -163,6 +163,7 @@ tplToString(struct template *__restrict__ const pTpl,
unsigned short bMustBeFreed = 0;
uchar *pVal;
rs_size_t iLenVal = 0;
+ int need_comma = 0;
if(pTpl->pStrgen != NULL) {
CHKiRet(pTpl->pStrgen(pMsg, iparam));
@@ -230,15 +231,24 @@ tplToString(struct template *__restrict__ const pTpl,
if(iBuf + iLenVal + extra_space >= iparam->lenBuf) /* we reserve one char for the final \0! */
CHKiRet(ExtendBuf(iparam, iBuf + iLenVal + 1));
+ if(need_comma) {
+ memcpy(iparam->param + iBuf, ", ", 2);
+ iBuf += 2;
+ }
memcpy(iparam->param + iBuf, pVal, iLenVal);
iBuf += iLenVal;
if(pTpl->optFormatEscape == JSONF) {
- memcpy(iparam->param + iBuf,
- (pTpe->pNext == NULL) ? "}\n" : ", ", 2);
- iBuf += 2;
+ need_comma = 1;
}
}
+ if((pTpl->optFormatEscape == JSONF) && (pTpe->pNext == NULL)) {
+ /* space was reserved while processing field above
+ (via extra_space in ExtendBuf() new size formula. */
+ memcpy(iparam->param + iBuf, "}\n", 2);
+ iBuf += 2;
+ }
+
if(bMustBeFreed) {
free(pVal);
bMustBeFreed = 0;
--
2.27.0

View File

@ -1,84 +0,0 @@
From deefc958c388995fac99c581284fb86eb9653ece Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Thu, 23 Mar 2023 10:58:32 +0100
Subject: [PATCH] [backport] core/bugfix: using $uuid msg prop can deadlock
rsyslog on shutdown
This problem can occur if a large number of threads is used and rsyslog
cannot shut down all queues etc within the regular time interval. In this
case, it cancels some threads. That can leave the mutex guarding libuuid
calls locked and thus prevents other, not yet cancelled threads from
progressing. Assuming pthread_mutex_lock() is not a cancellation point,
this will case these other threads to hang forever and thus create a
deadlock situation.
closes https://github.com/rsyslog/rsyslog/issues/5104
---
Conflict:NA
Type:bugfix
Reference:https://github.com/rsyslog/rsyslog/commit/82687e14fbf3d854e8cc954efb9fb0efa69a28d2
---
---
runtime/msg.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/runtime/msg.c b/runtime/msg.c
index 73b7cec80..a3ddb8684 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -7,7 +7,7 @@
* of the "old" message code without any modifications. However, it
* helps to have things at the right place one we go to the meat of it.
*
- * Copyright 2007-2022 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2007-2023 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@@ -1618,13 +1618,22 @@ msgSetPRI(smsg_t *const __restrict__ pMsg, syslog_pri_t pri)
/* note: libuuid seems not to be thread-safe, so we need
* to get some safeguards in place.
*/
+static pthread_mutex_t mutUUID = PTHREAD_MUTEX_INITIALIZER;
+
+static void call_uuid_generate(uuid_t uuid)
+{
+ pthread_mutex_lock(&mutUUID);
+ pthread_cleanup_push(mutexCancelCleanup, &mutUUID);
+ uuid_generate(uuid);
+ pthread_cleanup_pop(1);
+}
+
static void msgSetUUID(smsg_t * const pM)
{
size_t lenRes = sizeof(uuid_t) * 2 + 1;
char hex_char [] = "0123456789ABCDEF";
unsigned int byte_nbr;
uuid_t uuid;
- static pthread_mutex_t mutUUID = PTHREAD_MUTEX_INITIALIZER;
dbgprintf("[MsgSetUUID] START, lenRes %llu\n", (long long unsigned) lenRes);
assert(pM != NULL);
@@ -1632,9 +1641,7 @@ static void msgSetUUID(smsg_t * const pM)
if((pM->pszUUID = (uchar*) malloc(lenRes)) == NULL) {
pM->pszUUID = (uchar *)"";
} else {
- pthread_mutex_lock(&mutUUID);
- uuid_generate(uuid);
- pthread_mutex_unlock(&mutUUID);
+ call_uuid_generate(uuid);
for (byte_nbr = 0; byte_nbr < sizeof (uuid_t); byte_nbr++) {
pM->pszUUID[byte_nbr * 2 + 0] = hex_char[uuid [byte_nbr] >> 4];
pM->pszUUID[byte_nbr * 2 + 1] = hex_char[uuid [byte_nbr] & 15];
@@ -5352,5 +5359,3 @@ BEGINObjClassInit(msg, 1, OBJ_IS_CORE_MODULE)
INIT_ATOMIC_HELPER_MUT(mutTrimCtr);
# endif
ENDObjClassInit(msg)
-/* vim:set ai:
- */
--
2.12.3

View File

@ -1,38 +0,0 @@
From 45900dd550e0aca724a4ec66c2833de3d27565e1 Mon Sep 17 00:00:00 2001
From: alakatos <alakatos@redhat.com>
Date: Mon, 31 Oct 2022 14:40:12 +0100
Subject: [PATCH] [backport] imjournal: add second fallback to _COMM
If SYSLOG_IDENTIFIER is not present in the journal message,
then lookup the _COMM field, which stands for the name
of the process the journal entry originates from. This is
needed in order to be in compliance with the journalctl
output.
---
Conflict:NA
Type:bugfix
Reference:https://github.com/rsyslog/rsyslog/commit/fb5ae30e6ac4dc584dd9c5463e27e7fc5e9060a4
---
---
plugins/imjournal/imjournal.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
index 6fb3b7a07..4d9e59966 100644
--- a/plugins/imjournal/imjournal.c
+++ b/plugins/imjournal/imjournal.c
@@ -453,6 +453,8 @@ readjournal(void)
/* Get message identifier, client pid and add ':' */
if (journalGetData("SYSLOG_IDENTIFIER", &get, &length) >= 0) {
CHKiRet(sanitizeValue(((const char *)get) + 18, length - 18, &sys_iden));
+ } else if (journalGetData("_COMM", &get, &length) >= 0) {
+ CHKiRet(sanitizeValue(((const char *)get) + 6, length - 6, &sys_iden));
} else {
CHKmalloc(sys_iden = strdup("journal"));
}
--
2.12.3

View File

@ -1,98 +0,0 @@
From 2623a89a0c66cced8fc37ac1daa0da936005bad6 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Tue, 15 Nov 2022 15:11:50 +0100
Subject: [PATCH] imtcp bugfix: legacy config directives did no longer work
Many "$InputTCPServer..." config directives did no longer work
and were completely ignored (e.g. "$InputTCPServerStreamDriverMode").
This was a regression from a08591be5d9 (May, 5th 2021).
closes https://github.com/rsyslog/rsyslog/issues/5021
Conflict:NA
Reference:https://github.com/rsyslog/rsyslog/commit/2623a89a0c66cced8fc37ac1daa0da936005bad6
---
plugins/imtcp/imtcp.c | 15 ++++++++++++++-
runtime/nsd_gtls.c | 3 ++-
tests/imtcp-tls-gtls-x509name-legacy.sh | 10 ++++++----
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index ccc99b0..e275750 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -446,6 +446,20 @@ static rsRetVal addInstance(void __attribute__((unused)) *pVal, uchar *pNewVal)
CHKmalloc(inst->pszInputName = ustrdup(cs.pszInputName));
}
inst->cnf_params->bSuppOctetFram = cs.bSuppOctetFram;
+ inst->iStrmDrvrMode = cs.iStrmDrvrMode;
+ inst->bKeepAlive = cs.bKeepAlive ;
+ inst->bUseFlowControl = cs.bUseFlowControl;
+ inst->bDisableLFDelim = cs.bDisableLFDelim;
+ inst->bEmitMsgOnClose = cs.bEmitMsgOnClose;
+ inst->bPreserveCase = cs.bPreserveCase;
+ inst->iKeepAliveProbes = cs.iKeepAliveProbes;
+ inst->iKeepAliveIntvl = cs.iKeepAliveIntvl;
+ inst->iKeepAliveTime = cs.iKeepAliveTime;
+ inst->iKeepAliveTime = cs.iKeepAliveTime;
+ inst->iAddtlFrameDelim = cs.iAddtlFrameDelim;
+ inst->iTCPLstnMax = cs.iTCPLstnMax;
+ inst->iTCPSessMax = cs.iTCPSessMax;
+ inst->iStrmDrvrMode = cs.iStrmDrvrMode;
finalize_it:
free(pNewVal);
@@ -952,7 +966,6 @@ RunServerThread(void *myself)
{
tcpsrv_etry_t *const etry = (tcpsrv_etry_t*) myself;
rsRetVal iRet;
- dbgprintf("RGER: running ety %p\n", etry);
iRet = tcpsrv.Run(etry->tcpsrv);
if(iRet != RS_RET_OK) {
LogError(0, iRet, "imtcp: error while terminating server; rsyslog may hang on shutdown");
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index 65e492d..378febb 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -1430,12 +1430,13 @@ ENDobjDestruct(nsd_gtls)
* rgerhards, 2008-04-28
*/
static rsRetVal
-SetMode(nsd_t *pNsd, int mode)
+SetMode(nsd_t *const pNsd, const int mode)
{
DEFiRet;
nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd;
ISOBJ_TYPE_assert((pThis), nsd_gtls);
+ dbgprintf("(tls) mode: %d\n", mode);
if(mode != 0 && mode != 1) {
LogError(0, RS_RET_INVALID_DRVR_MODE, "error: driver mode %d not supported by "
"gtls netstream driver", mode);
diff --git a/tests/imtcp-tls-gtls-x509name-legacy.sh b/tests/imtcp-tls-gtls-x509name-legacy.sh
index c2c9bdd..4e8878c 100755
--- a/tests/imtcp-tls-gtls-x509name-legacy.sh
+++ b/tests/imtcp-tls-gtls-x509name-legacy.sh
@@ -12,12 +12,14 @@ global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'"
# NOTE: we intentionally use legacy statements here! This *IS* what we want to test!
$ModLoad ../plugins/imtcp/.libs/imtcp
+$DefaultNetstreamDriver gtls
$inputTcpserverStreamdriverPermittedPeer rsyslog-client
-input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port"
- StreamDriver.Name="gtls"
- StreamDriver.Mode="1"
- StreamDriver.AuthMode="x509/name")
+$InputTCPServerStreamDriverAuthMode x509/name
+$InputTCPServerStreamDriverPermittedPeer Log_Streaming_Client
+$InputTCPServerStreamDriverMode 1
+$InputTCPServerListenPortFile '$RSYSLOG_DYNNAME'.tcpflood_port
+$InputTCPServerRun 0
template(name="outfmt" type="string" string="%msg:F,58:2%\n")
:msg, contains, "msgnum:" action( type="omfile"
--
2.27.0

View File

@ -1,47 +0,0 @@
From 1128d320750fb6cfe57b8ad53ef1d5ddf80c81cf Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Sun, 4 Dec 2022 16:05:22 +0100
Subject: [PATCH] omprog bugfix: invalid status handling at called program
There is a bug when external program *startup* does not return "OK". This
can also lead to a misadressing with potentially a segfault (very unlikely).
Note that no problem exists once the initializiation phase of the external
program is finished and regular message transfer runs.
The problem basically is that for a startup failure, the control data for
that external program instance is freed on error. Unfortunately, that state
data is needed later on to detect a suspended instance. We now keep the control
data even on init failure (as we then need to do normal control options).
closes https://github.com/rsyslog/rsyslog/issues/4967
---
Conflict:NA
Reference:https://github.com/rsyslog/rsyslog/commit/1128d320750fb6cfe57b8ad53ef1d5ddf80c81cf
---
plugins/omprog/omprog.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c
index 4f46f92..dd83e93 100644
--- a/plugins/omprog/omprog.c
+++ b/plugins/omprog/omprog.c
@@ -379,6 +379,7 @@ cleanupChild(instanceData *pData, childProcessCtx_t *pChildCtx)
static void
terminateChild(instanceData *pData, childProcessCtx_t *pChildCtx)
{
+ DBGPRINTF("terminateChild called\n");
assert(pChildCtx->bIsRunning);
if (pData->bSignalOnClose) {
@@ -927,9 +928,6 @@ CODESTARTcreateWrkrInstance
}
finalize_it:
- if(iRet != RS_RET_OK && !pWrkrData->pData->bForceSingleInst) {
- free(pWrkrData->pChildCtx);
- }
ENDcreateWrkrInstance
--
2.27.0

View File

@ -9,10 +9,10 @@ Signed-off-by: wangshouping <wangshouping@huawei.com>
1 file changed, 17 insertions(+), 2 deletions(-) 1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
index 29dcec1..3a93b37 100644 index cda9b4b..2268018 100644
--- a/plugins/imjournal/imjournal.c --- a/plugins/imjournal/imjournal.c
+++ b/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c
@@ -386,6 +386,7 @@ readjournal(void) @@ -447,6 +447,7 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
struct timeval tv; struct timeval tv;
uint64_t timestamp; uint64_t timestamp;
@ -20,7 +20,7 @@ index 29dcec1..3a93b37 100644
struct fjson_object *json = NULL; struct fjson_object *json = NULL;
int r; int r;
@@ -395,6 +396,9 @@ readjournal(void) @@ -456,6 +457,9 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
char *sys_iden; char *sys_iden;
char *sys_iden_help = NULL; char *sys_iden_help = NULL;
@ -30,13 +30,13 @@ index 29dcec1..3a93b37 100644
const void *get; const void *get;
const void *pidget; const void *pidget;
size_t length; size_t length;
@@ -501,8 +505,19 @@ readjournal(void) @@ -564,8 +568,19 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
iRet = updateJournalCursor(); iRet = updateJournalCursor(journalContext);
- /* submit message */ - /* submit message */
- enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); - enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
+ if (journalGetData("_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0) + if (journalGetData(journalContext, "_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0)
+ { + {
+ t = strndup(get+28, length-28); + t = strndup(get+28, length-28);
+ monotonic_timestamp = atoll(t); + monotonic_timestamp = atoll(t);
@ -44,11 +44,11 @@ index 29dcec1..3a93b37 100644
+ tpmessage = (char *)malloc(strlen(message)+30); + tpmessage = (char *)malloc(strlen(message)+30);
+ int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000); + int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
+ memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1); + memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
+ enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); + enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
+ free(tpmessage); + free(tpmessage);
+ }else + }else
+ /* submit message */ + /* submit message */
+ enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); + enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
finalize_it: finalize_it:
free(sys_iden_help); free(sys_iden_help);

View File

@ -10,22 +10,22 @@ V-3: adapt pMsgQueue to runConf->pMsgQueue
Signed-off-by: wangshouping <wangshouping@huawei.com> Signed-off-by: wangshouping <wangshouping@huawei.com>
Signed-off-by: pengyi37 <pengyi37@huawei.com> Signed-off-by: pengyi37 <pengyi37@huawei.com>
--- ---
tools/rsyslogd.c | 30 ++++++++++++++++++++++++++++++ tools/rsyslogd.c | 29 +++++++++++++++++++++++++++++
1 file changed, 30 insertions(+) 1 file changed, 29 insertions(+)
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
index 31b91a1..b92aca5 100644 index d27a2a7..6aa81b8 100644
--- a/tools/rsyslogd.c --- a/tools/rsyslogd.c
+++ b/tools/rsyslogd.c +++ b/tools/rsyslogd.c
@@ -36,6 +36,7 @@ @@ -37,6 +37,7 @@
#endif #endif
#ifdef HAVE_LIBSYSTEMD #ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-daemon.h> # include <systemd/sd-daemon.h>
+#include <systemd/sd-journal.h> +#include <systemd/sd-journal.h>
#endif #endif
#ifdef ENABLE_LIBCAPNG
#include "rsyslog.h" #include <cap-ng.h>
@@ -182,6 +183,9 @@ static pthread_mutex_t mutChildDied; @@ -189,6 +190,9 @@ static pthread_mutex_t mutChildDied;
static int bChildDied = 0; static int bChildDied = 0;
static pthread_mutex_t mutHadHUP; static pthread_mutex_t mutHadHUP;
static int bHadHUP; static int bHadHUP;
@ -35,11 +35,8 @@ index 31b91a1..b92aca5 100644
static int doFork = 1; /* fork - run in daemon mode - read-only after startup */ 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 int bFinished = 0; /* used by termination signal handler, read-only except there
* is either 0 or the number of the signal that requested the * is either 0 or the number of the signal that requested the
@@ -1294,9 +1298,16 @@ rsyslogdDebugSwitch(void) @@ -1377,6 +1381,12 @@ rsyslogdDebugSwitch(void)
dbgprintf("\n");
debugging_on = 0;
} }
+
} }
+#ifdef HAVE_LIBSYSTEMD +#ifdef HAVE_LIBSYSTEMD
@ -47,12 +44,11 @@ index 31b91a1..b92aca5 100644
+{ +{
+ g_bRecordQueue = 1; + g_bRecordQueue = 1;
+} +}
+#endif +#endif
/* This is the main entry point into rsyslogd. Over time, we should try to /* This is the main entry point into rsyslogd. Over time, we should try to
* modularize it a bit more... * modularize it a bit more...
* @@ -1798,7 +1808,11 @@ initAll(int argc, char **argv)
@@ -1629,7 +1640,11 @@ initAll(int argc, char **argv)
hdlr_enable(SIGINT, rsyslogdDoDie); hdlr_enable(SIGINT, rsyslogdDoDie);
hdlr_enable(SIGQUIT, rsyslogdDoDie); hdlr_enable(SIGQUIT, rsyslogdDoDie);
} else { } else {
@ -64,7 +60,7 @@ index 31b91a1..b92aca5 100644
hdlr_enable(SIGINT, SIG_IGN); hdlr_enable(SIGINT, SIG_IGN);
hdlr_enable(SIGQUIT, SIG_IGN); hdlr_enable(SIGQUIT, SIG_IGN);
} }
@@ -1971,6 +1986,9 @@ mainloop(void) @@ -2143,6 +2157,9 @@ mainloop(void)
sigaddset(&sigblockset, SIGTERM); sigaddset(&sigblockset, SIGTERM);
sigaddset(&sigblockset, SIGCHLD); sigaddset(&sigblockset, SIGCHLD);
sigaddset(&sigblockset, SIGHUP); sigaddset(&sigblockset, SIGHUP);
@ -74,20 +70,20 @@ index 31b91a1..b92aca5 100644
do { do {
pthread_sigmask(SIG_BLOCK, &sigblockset, &origmask); pthread_sigmask(SIG_BLOCK, &sigblockset, &origmask);
@@ -2000,6 +2018,18 @@ mainloop(void) @@ -2174,6 +2191,18 @@ mainloop(void)
processImInternal(); processImInternal();
+#ifdef HAVE_LIBSYSTEMD +#ifdef HAVE_LIBSYSTEMD
+ if (g_bRecordQueue) { + if (g_bRecordQueue) {
+ if (runConf->pMsgQueue != NULL) { + if (runConf->pMsgQueue != NULL) {
+ sd_journal_print(LOG_NOTICE, "main queue size information: current QueueSize=%d MaxQeueSize=%d\n", + sd_journal_print(LOG_NOTICE, "main queue size information: current QueueSize=%d MaxQeueSize=%d\n",
+ runConf->pMsgQueue->iQueueSize, runConf->pMsgQueue->iMaxQueueSize); + runConf->pMsgQueue->iQueueSize, runConf->pMsgQueue->iMaxQueueSize);
+ } else { + } else {
+ sd_journal_print(LOG_NOTICE, "main queue size information: pMsgQueue is NULL!\n"); + sd_journal_print(LOG_NOTICE, "main queue size information: pMsgQueue is NULL!\n");
+ }
+ g_bRecordQueue = 0;
+ } + }
+ g_bRecordQueue = 0;
+ }
+#endif +#endif
+ +
if(bFinished) if(bFinished)

Binary file not shown.

BIN
rsyslog-8.2312.0.tar.gz Normal file

Binary file not shown.

View File

@ -9,10 +9,10 @@ Signed-off-by: wangshouping <wangshouping@huawei.com>
1 file changed, 13 insertions(+), 9 deletions(-) 1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
index aa27fe7..c5d3d25 100644 index 2268018..b7125a0 100644
--- a/plugins/imjournal/imjournal.c --- a/plugins/imjournal/imjournal.c
+++ b/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c
@@ -386,7 +386,7 @@ readjournal(void) @@ -447,7 +447,7 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
struct timeval tv; struct timeval tv;
uint64_t timestamp; uint64_t timestamp;
@ -21,7 +21,7 @@ index aa27fe7..c5d3d25 100644
struct fjson_object *json = NULL; struct fjson_object *json = NULL;
int r; int r;
@@ -396,8 +396,8 @@ readjournal(void) @@ -457,8 +457,8 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
char *sys_iden; char *sys_iden;
char *sys_iden_help = NULL; char *sys_iden_help = NULL;
@ -32,29 +32,29 @@ index aa27fe7..c5d3d25 100644
const void *get; const void *get;
const void *pidget; const void *pidget;
@@ -508,13 +508,17 @@ readjournal(void) @@ -571,13 +571,17 @@ readjournal(struct journalContext_s *journalContext, ruleset_t *pBindRuleset)
if (journalGetData("_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0) if (journalGetData(journalContext, "_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0)
{ {
t = strndup(get+28, length-28); t = strndup(get+28, length-28);
- monotonic_timestamp = atoll(t); - monotonic_timestamp = atoll(t);
- free(t); - free(t);
+ if (t != NULL) { + if (t != NULL) {
+ monotonic_timestamp = atoll(t); + monotonic_timestamp = atoll(t);
+ free(t); + free(t);
+ } + }
tpmessage = (char *)malloc(strlen(message)+30); tpmessage = (char *)malloc(strlen(message)+30);
- int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000); - int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
- memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1); - memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
- enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); - enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
- free(tpmessage); - free(tpmessage);
+ if (tpmessage != NULL) { + if (tpmessage != NULL) {
+ int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000); + int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
+ memcpy(tpmessage+(ret >= 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1); + memcpy(tpmessage+(ret >= 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
+ enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); + enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
+ free(tpmessage); + free(tpmessage);
+ } + }
}else }else
/* submit message */ /* submit message */
enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0); enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0, pBindRuleset);
-- --
2.27.0 2.27.0

Binary file not shown.

BIN
rsyslog-doc-8.2312.0.tar.gz Normal file

Binary file not shown.

View File

@ -12,6 +12,6 @@
size +4096k size +4096k
sharedscripts sharedscripts
postrotate postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true /usr/bin/systemctl reload rsyslog.service >/dev/null 2>&1 || true
endscript endscript
} }

View File

@ -6,8 +6,8 @@
%define systemd_lived 1 %define systemd_lived 1
Name: rsyslog Name: rsyslog
Version: 8.2210.0 Version: 8.2312.0
Release: 7 Release: 1
Summary: The rocket-fast system for log processing Summary: The rocket-fast system for log processing
License: (GPLv3+ and ASL 2.0) License: (GPLv3+ and ASL 2.0)
URL: http://www.rsyslog.com/ URL: http://www.rsyslog.com/
@ -20,7 +20,7 @@ Source5: os_rotate_and_save_log.sh
Source6: os_check_timezone_for_rsyslog.sh Source6: os_check_timezone_for_rsyslog.sh
Source7: timezone.cron Source7: timezone.cron
Source8: rsyslog.service Source8: rsyslog.service
Source9: timezone_update.sh Source9: timezone_update.sh
Patch9000: rsyslog-8.24.0-ensure-parent-dir-exists-when-writting-log-file.patch Patch9000: rsyslog-8.24.0-ensure-parent-dir-exists-when-writting-log-file.patch
Patch9001: bugfix-rsyslog-7.4.7-imjournal-add-monotonic-timestamp.patch Patch9001: bugfix-rsyslog-7.4.7-imjournal-add-monotonic-timestamp.patch
@ -29,15 +29,7 @@ Patch9003: rsyslog-8.37.0-initialize-variables-and-check-return-value.patch
Patch9004: print-main-queue-info-to-journal-when-queue-full.patch Patch9004: print-main-queue-info-to-journal-when-queue-full.patch
Patch9005: print-main-queue-info-to-journal-when-receive-USR1-signal.patch Patch9005: print-main-queue-info-to-journal-when-receive-USR1-signal.patch
Patch6000: backport-core-bugfix-local-hostname-invalid-if-no-global-config-object-given.patch Patch6000: backport-outchannel-eleminate-type-cast-for-compatibility-rea.patch
Patch6001: backport-imtcp-bugfix-legacy-config-directives-did-no-longer-work.patch
Patch6002: backport-core-bugfix-template-system-may-generate-invalid-json.patch
Patch6003: backport-omprog-bugfix-invalid-status-handling-at-called-prog.patch
Patch6004: backport-imjournal-add-second-fallback-to-_COMM.patch
Patch6005: backport-bugfix-prevent-pot.-segfault-when-switchung.patch
Patch6006: backport-core-bugfix-using-uuid-msg-prop-can-deadloc.patch
Patch6007: backport-GNUTls-Driver-Fix-memory-leaks-in-gtlsInitC.patch
Patch6008: backport-outchannel-eleminate-type-cast-for-compatibility-rea.patch
BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool
BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel
@ -141,7 +133,7 @@ This package provides support from rabbitmq.
Summary: RELP protocol support for rsyslog Summary: RELP protocol support for rsyslog
Group: System Environment/Daemons Group: System Environment/Daemons
Requires: %name = %version-%release Requires: %name = %version-%release
BuildRequires: librelp-devel >= 1.0.3 BuildRequires: librelp-devel >= 1.2.16
%description relp %description relp
The rsyslog-relp package contains the rsyslog plugins that provide The rsyslog-relp package contains the rsyslog plugins that provide
@ -239,6 +231,13 @@ This module is similar to the regular UDP forwarder, but permits to
spoof the sender address. Also, it enables to circle through a number spoof the sender address. Also, it enables to circle through a number
of source ports. of source ports.
%package mmtaghostname
Summary: Message modification module supporting adding tags
Requires: %name = %version-%release
%description mmtaghostname
This module provides message modification for changing or adding the host name.
%package_help %package_help
Provides: %{name}-doc Provides: %{name}-doc
@ -303,7 +302,8 @@ export HIREDIS_LIBS="-L%{_libdir} -lhiredis"
--enable-snmp \ --enable-snmp \
--enable-unlimited-select \ --enable-unlimited-select \
--enable-usertools \ --enable-usertools \
--enable-omkafka --enable-omkafka \
--enable-mmtaghostname
%make_build %make_build
@ -496,6 +496,9 @@ done
%files udpspoof %files udpspoof
%{_libdir}/rsyslog/omudpspoof.so %{_libdir}/rsyslog/omudpspoof.so
%files mmtaghostname
%{_libdir}/rsyslog/mmtaghostname.so
%files help %files help
%doc %{rsyslog_docdir}/html %doc %{rsyslog_docdir}/html
%{_mandir}/man5/rsyslog.conf.5.gz %{_mandir}/man5/rsyslog.conf.5.gz
@ -503,6 +506,12 @@ done
%{_mandir}/man1/rscryutil.1.gz %{_mandir}/man1/rscryutil.1.gz
%changelog %changelog
* Sun Feb 18 2024 sunhai <sunhai10@huawei.com> - 8.2312.0-1
- Type:NA
- ID:NA
- SUG:NA
- DESC: update to 8.2312 version
* Mon Dec 25 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 8.2210.0-7 * Mon Dec 25 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 8.2210.0-7
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA