Blame SOURCES/rsyslog-8.1911.0-rhbz1659898-imjournal-default-tag.patch

937096
diff -up ./plugins/imjournal/imjournal.c.default-tag ./plugins/imjournal/imjournal.c
937096
--- ./plugins/imjournal/imjournal.c.default-tag	2018-05-17 08:50:11.416418022 -0400
937096
+++ ./plugins/imjournal/imjournal.c	2018-05-17 08:53:02.884418022 -0400
937096
@@ -78,6 +78,7 @@ static struct configSettings_s {
937096
 	int bWorkAroundJournalBug; /* deprecated, left for backwards compatibility only */
937096
 	int bFsync;
937096
 	int bRemote;
937096
+	char *dfltTag;
937096
 } cs;
937096
 
937096
 static rsRetVal facilityHdlr(uchar **pp, void *pVal);
937096
@@ -93,7 +94,8 @@ static struct cnfparamdescr modpdescr[]
937096
 	{ "usepid", eCmdHdlrString, 0 },
937096
 	{ "workaroundjournalbug", eCmdHdlrBinary, 0 },
937096
 	{ "fsync", eCmdHdlrBinary, 0 },
937096
-	{ "remote", eCmdHdlrBinary, 0 }
937096
+	{ "remote", eCmdHdlrBinary, 0 },
937096
+	{ "defaulttag", eCmdHdlrGetWord, 0 }
937096
 };
937096
 static struct cnfparamblk modpblk =
937096
 	{ CNFPARAMBLK_VERSION,
937096
@@ -104,6 +106,7 @@ static struct cnfparamblk modpblk =
937096
 #define DFLT_persiststateinterval 10
937096
 #define DFLT_SEVERITY pri2sev(LOG_NOTICE)
937096
 #define DFLT_FACILITY pri2fac(LOG_USER)
937096
+#define DFLT_TAG "journal"
937096
 
937096
 static int bLegacyCnfModGlobalsPermitted = 1;/* are legacy module-global config parameters permitted? */
937096
 
937096
@@ -268,7 +271,7 @@ readjournal(void)
937096
 
937096
 	/* Information from messages */
937096
 	char *message = NULL;
937096
-	char *sys_iden;
937096
+	char *sys_iden = NULL;
937096
 	char *sys_iden_help = NULL;
937096
 
937096
 	const void *get;
937096
@@ -331,7 +334,7 @@ readjournal(void)
937096
 	if (journalGetData("SYSLOG_IDENTIFIER", &get, &length) >= 0) {
937096
 		CHKiRet(sanitizeValue(((const char *)get) + 18, length - 18, &sys_iden));
937096
 	} else {
937096
-		CHKmalloc(sys_iden = strdup("journal"));
937096
+		CHKmalloc(sys_iden = strdup(cs.dfltTag));
937096
 	}
937096
 
937096
 	/* trying to get PID, default is "SYSLOG_PID" property */
937096
@@ -654,6 +657,11 @@ CODESTARTrunInput
937096
 			"\"usepidfromsystem\" is depricated, use \"usepid\" instead");
937096
 	}
937096
 
937096
+	if (cs.dfltTag == NULL) {
937096
+		cs.dfltTag = strdup(DFLT_TAG);
937096
+	}
937096
+
937096
+
937096
 	if (cs.usePid && (strcmp(cs.usePid, "system") == 0)) {
937096
 		pidFieldName = "_PID";
937096
 		bPidFallBack = 0;
937096
@@ -732,6 +740,7 @@ CODESTARTbeginCnfLoad
937096
 	cs.bWorkAroundJournalBug = 1;
937096
 	cs.bFsync = 0;
937096
 	cs.bRemote = 0;
937096
+	cs.dfltTag = NULL;
937096
 ENDbeginCnfLoad
937096
 
937096
 
937096
@@ -754,6 +763,7 @@ BEGINfreeCnf
937096
 CODESTARTfreeCnf
937096
 	free(cs.stateFile);
937096
 	free(cs.usePid);
937096
+	free(cs.dfltTag);
937096
 	free(journalContext.cursor);
937096
 	statsobj.Destruct(&(statsCounter.stats));
937096
 ENDfreeCnf
937096
@@ -832,6 +842,8 @@ CODESTARTsetModCnf
937096
 			cs.bFsync = (int) pvals[i].val.d.n;
937096
 		} else if (!strcmp(modpblk.descr[i].name, "remote")) {
937096
 			cs.bRemote = (int) pvals[i].val.d.n;
937096
+		} else if (!strcmp(modpblk.descr[i].name, "defaulttag")) {
937096
+			cs.dfltTag = (char *)es_str2cstr(pvals[i].val.d.estr, NULL);
937096
 		} else {
937096
 			dbgprintf("imjournal: program error, non-handled "
937096
 				"param '%s' in beginCnfLoad\n", modpblk.descr[i].name);
937096
@@ -799,6 +820,8 @@ CODEmodInit_QueryRegCFSLineHdlr
937096
 		facilityHdlr, &cs.iDfltFacility, STD_LOADABLE_MODULE_ID));
937096
 	CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournalusepidfromsystem", 0, eCmdHdlrBinary,
937096
 		NULL, &cs.bUseJnlPID, STD_LOADABLE_MODULE_ID));
937096
+	CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournaldefaulttag", 0, eCmdHdlrGetWord,
937096
+		NULL, &cs.dfltTag, STD_LOADABLE_MODULE_ID));
937096
 ENDmodInit
937096
 /* vim:set ai:
937096
  */