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