Revert "rsyslog: imjournal: Support input module"
This reverts commit 1c9e7595c8d4c2f6bd2222f0a21d7c68b3737048.
Reason for revert: Need to create a hotfix release for 23.6.x with just
nemorad fix on top of 23.6.36.
Change-Id: I0cde2b9256c4f2214ea118f2d1609e8e9975d5a5
Google-Bug-Id: 284496343
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/recipes-extended/rsyslog/rsyslog/0001-imjournal-Support-input-module.patch b/recipes-extended/rsyslog/rsyslog/0001-imjournal-Support-input-module.patch
deleted file mode 100644
index 0f360c3..0000000
--- a/recipes-extended/rsyslog/rsyslog/0001-imjournal-Support-input-module.patch
+++ /dev/null
@@ -1,289 +0,0 @@
-From 07fd09d2dacac0537329e0da9899c1e0c7d2a58d Mon Sep 17 00:00:00 2001
-From: Willy Tu <wltu@google.com>
-Date: Tue, 7 Mar 2023 12:49:12 -0800
-Subject: [PATCH] imjournal: Support input module
-
-Allow us to bind the imjournal input to an output module. The enable us
-to block journal reading if the output module is failing. Note that we
-will only allow one input module for imjournal since we do not have
-multiple input sources. The memory usage can be high with multiple
-outputs.
-
-Tested:
-
-Example Config:
-```
-template(name="journal-format" type="string"
- string="%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag% %msg%\n"
-)
-
-ruleset(name="remote" queue.type="direct"){
- action(
- type="omfwd"
- target="IP_ADDRESS"
- port="PORT"
- protocol="tcp"
- template="journal-format"
- StreamDriver="ossl"
- StreamDriverMode="0"
- StreamDriverAuthMode="anon"
- action.resumeRetryCount="-1"
- )
-}
-
-input(
- type="imjournal"
- ruleset="remote"
-)
-```
-
-- Stop collector network -> Stop Journal pointer
-```
-SECONDS=0
-expected="$(md5sum /var/log/state)"
-echo "Expected state ${expected}"
-while [ $SECONDS -lt 300 ];
-do
- new_state="$(md5sum /var/log/state)"
- if [[ "${new_state}" != "${expected}" ]];
- then
- echo "Got state ${new_state} instead of ${expected}"
- exit 1
- fi
- sleep 5
-done
-echo "Passed"
-exit 0
-```
-
-```
-Expected state 309593de34bc095e4245c1ba07a7520c /var/log/state
-Passed
-```
-
-- Resume Journal Pointer
-
-The state file changed after the connection resumed.
-```
-$ md5sum /var/log/state
-d11c7e46fec4f86151df204608525d89 /var/log/state
-```
-
-The message send in when the connection was down is also sent out properly.
-
-Patch Tracking Bug: b/283335713
-Upstream info / review:
- https://github.com/rsyslog/rsyslog/pull/5146
-Upstream-Status: Submitted
-Justification: High priority fixes for high disk usage with rsyslog when network is down.
-bugfix(b/281475520)
-Signed-off-by: Willy Tu <wltu@google.com>
----
- plugins/imjournal/imjournal.c | 110 +++++++++++++++++++++++++++++++++-
- 1 file changed, 109 insertions(+), 1 deletion(-)
-
-diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
-index 56e50fb2f..5aaafa42b 100644
---- a/plugins/imjournal/imjournal.c
-+++ b/plugins/imjournal/imjournal.c
-@@ -45,6 +45,7 @@
- #include "net.h"
- #include "glbl.h"
- #include "statsobj.h"
-+#include "ruleset.h"
- #include "parser.h"
- #include "prop.h"
- #include "errmsg.h"
-@@ -64,11 +65,13 @@ DEFobjCurrIf(glbl)
- DEFobjCurrIf(parser)
- DEFobjCurrIf(prop)
- DEFobjCurrIf(net)
-+DEFobjCurrIf(ruleset)
- DEFobjCurrIf(statsobj)
-
- struct modConfData_s {
- rsconf_t *pConf;
- int bIgnPrevMsg;
-+ instanceConf_t *inst;
- };
-
- static struct configSettings_s {
-@@ -111,6 +114,23 @@ static struct cnfparamblk modpblk =
- modpdescr
- };
-
-+/* input instance parameters */
-+static struct cnfparamdescr inppdescr[] = {
-+ { "ruleset", eCmdHdlrString, 0 },
-+};
-+static struct cnfparamblk inppblk =
-+ { CNFPARAMBLK_VERSION,
-+ sizeof(inppdescr)/sizeof(struct cnfparamdescr),
-+ inppdescr
-+ };
-+
-+struct instanceConf_s {
-+ uchar *pszBindRuleset;
-+ ruleset_t *pBindRuleset; /* ruleset to bind listener to (use system default if unspecified) */
-+};
-+
-+#include "im-helper.h" /* must be included AFTER the type definitions! */
-+
- #define DFLT_persiststateinterval 10
- #define DFLT_SEVERITY pri2sev(LOG_NOTICE)
- #define DFLT_FACILITY pri2fac(LOG_USER)
-@@ -359,6 +379,7 @@ int sharedJsonProperties)
- MsgSetRcvFromIP(pMsg, pLocalHostIP);
- MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
- MsgSetTAG(pMsg, pszTag, ustrlen(pszTag));
-+ MsgSetRuleset(pMsg, runModConf->inst->pBindRuleset);
- pMsg->iFacility = iFacility;
- pMsg->iSeverity = iSeverity;
-
-@@ -794,7 +815,6 @@ tryRecover(void) {
- openJournal();
- }
-
--
- BEGINrunInput
- uint64_t count = 0;
- CODESTARTrunInput
-@@ -928,7 +948,16 @@ ENDendCnfLoad
-
-
- BEGINcheckCnf
-+ instanceConf_t *inst;
- CODESTARTcheckCnf
-+ if(pModConf->inst == NULL) {
-+ LogError(0, RS_RET_NO_LISTNERS , "imjournal: module loaded, but "
-+ "no binding defined.");
-+ iRet = RS_RET_NO_LISTNERS;
-+ } else {
-+ inst = pModConf->inst;
-+ std_checkRuleset(pModConf, inst);
-+ }
- ENDcheckCnf
-
-
-@@ -973,7 +1002,15 @@ ENDactivateCnf
-
-
- BEGINfreeCnf
-+ instanceConf_t *inst, *del;
- CODESTARTfreeCnf
-+ inst = pModConf->inst;
-+ if ( inst != NULL ) {
-+ free(inst->pszBindRuleset);
-+ del = inst;
-+ inst = NULL;
-+ free(del);
-+ }
- free(cs.stateFile);
- free(cs.usePid);
- free(journalContext.cursor);
-@@ -1013,6 +1050,7 @@ CODESTARTmodExit
- objRelease(datetime, CORE_COMPONENT);
- objRelease(parser, CORE_COMPONENT);
- objRelease(prop, CORE_COMPONENT);
-+ objRelease(ruleset, CORE_COMPONENT);
- ENDmodExit
-
-
-@@ -1079,6 +1117,67 @@ finalize_it:
- cnfparamvalsDestruct(pvals, &modpblk);
- ENDsetModCnf
-
-+/* create input instance, set default parameters, and
-+ * add it to the list of instances.
-+ */
-+static rsRetVal ATTR_NONNULL(1)
-+createInstance(instanceConf_t **const pinst)
-+{
-+ DEFiRet;
-+ if (loadModConf->inst != NULL) {
-+ LogError(0, RS_RET_OK_WARN, "imjournal: input module with already "
-+ "created - Only allow one unique input module");
-+ *pinst = loadModConf->inst;
-+ FINALIZE;
-+ }
-+ instanceConf_t *inst;
-+ CHKmalloc(inst = malloc(sizeof(instanceConf_t)));
-+ inst->pBindRuleset = NULL;
-+ inst->pszBindRuleset = NULL;
-+
-+ /* node created, let's add to config */
-+ loadModConf->inst = inst;
-+ *pinst = inst;
-+finalize_it:
-+ RETiRet;
-+}
-+
-+
-+BEGINnewInpInst
-+ struct cnfparamvals *pvals;
-+ instanceConf_t *inst;
-+ int i;
-+CODESTARTnewInpInst
-+ DBGPRINTF("newInpInst (imjournal)\n");
-+
-+ pvals = nvlstGetParams(lst, &inppblk, NULL);
-+ if(pvals == NULL) {
-+ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
-+ }
-+
-+ if(Debug) {
-+ DBGPRINTF("input param blk in imjournal:\n");
-+ cnfparamsPrint(&inppblk, pvals);
-+ }
-+
-+ CHKiRet(createInstance(&inst));
-+
-+ for(i = 0 ; i < inppblk.nParams ; ++i) {
-+ if(!pvals[i].bUsed)
-+ continue;
-+ if(!strcmp(inppblk.descr[i].name, "ruleset")) {
-+ inst->pszBindRuleset = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
-+ } else {
-+ DBGPRINTF("program error, non-handled "
-+ "param '%s'\n", inppblk.descr[i].name);
-+ }
-+ }
-+finalize_it:
-+CODE_STD_FINALIZERnewInpInst
-+ if (pvals != NULL)
-+ cnfparamvalsDestruct(pvals, &inppblk);
-+ENDnewInpInst
-+
-
- BEGINisCompatibleWithFeature
- CODESTARTisCompatibleWithFeature
-@@ -1092,10 +1191,18 @@ CODESTARTqueryEtryPt
- CODEqueryEtryPt_STD_IMOD_QUERIES
- CODEqueryEtryPt_STD_CONF2_QUERIES
- CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES
-+CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES
- CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES
- ENDqueryEtryPt
-
-
-+static inline void
-+std_checkRuleset_genErrMsg(__attribute__((unused)) modConfData_t *modConf, instanceConf_t *inst)
-+{
-+ LogError(0, NO_ERRCODE, "imjournal: ruleset '%s' not found - "
-+ "using default ruleset instead", inst->pszBindRuleset);
-+}
-+
- BEGINmodInit()
- CODESTARTmodInit
- *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
-@@ -1106,6 +1213,7 @@ CODEmodInit_QueryRegCFSLineHdlr
- CHKiRet(objUse(prop, CORE_COMPONENT));
- CHKiRet(objUse(net, CORE_COMPONENT));
- CHKiRet(objUse(statsobj, CORE_COMPONENT));
-+ CHKiRet(objUse(ruleset, CORE_COMPONENT));
-
- /* we need to create the inputName property (only once during our lifetime) */
- CHKiRet(prop.CreateStringProp(&pInputName, UCHAR_CONSTANT("imjournal"), sizeof("imjournal") - 1));
---
-2.41.0.rc0.172.g3f132b7071-goog
-
diff --git a/recipes-extended/rsyslog/rsyslog_%.bbappend b/recipes-extended/rsyslog/rsyslog_%.bbappend
deleted file mode 100644
index 89739dc..0000000
--- a/recipes-extended/rsyslog/rsyslog_%.bbappend
+++ /dev/null
@@ -1,5 +0,0 @@
-FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:"
-
-SRC_URI:append:gbmc = " \
- file://0001-imjournal-Support-input-module.patch \
-"