summaryrefslogtreecommitdiffstats
path: root/plugins/imkmsg/imkmsg.c
diff options
context:
space:
mode:
authorMilan Bartos <mbartos@redhat.com>2012-09-12 09:39:34 +0200
committerMilan Bartos <mbartos@redhat.com>2012-09-24 08:45:33 +0200
commit498b8600707e979f78ee02641d56702784138b70 (patch)
tree980a8eb97473e373c25a40df39d69d8175b55654 /plugins/imkmsg/imkmsg.c
parent91948f610807cb5f42d15af5448126315fd9a0dd (diff)
downloadrsyslog-498b8600707e979f78ee02641d56702784138b70.tar.gz
rsyslog-498b8600707e979f78ee02641d56702784138b70.tar.bz2
rsyslog-498b8600707e979f78ee02641d56702784138b70.zip
Made imkmsg parse the messages instead of creating string to be parsed later.
modified: imkmsg.c modified: imkmsg.h modified: kmsg.c
Diffstat (limited to 'plugins/imkmsg/imkmsg.c')
-rw-r--r--plugins/imkmsg/imkmsg.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/plugins/imkmsg/imkmsg.c b/plugins/imkmsg/imkmsg.c
index dc8c1b93..20c49f60 100644
--- a/plugins/imkmsg/imkmsg.c
+++ b/plugins/imkmsg/imkmsg.c
@@ -63,7 +63,6 @@ DEFobjCurrIf(errmsg)
/* config settings */
typedef struct configSettings_s {
- int bPermitNonKernel; /* permit logging of messages not having LOG_KERN facility */
int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */
uchar *pszPath;
int console_log_level; /* still used for BSD */
@@ -77,7 +76,6 @@ static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config para
/* module-global parameters */
static struct cnfparamdescr modpdescr[] = {
{ "logpath", eCmdHdlrGetWord, 0 },
- { "permitnonkernelfacility", eCmdHdlrBinary, 0 },
{ "consoleloglevel", eCmdHdlrInt, 0 },
{ "internalmsgfacility", eCmdHdlrFacility, 0 }
};
@@ -87,16 +85,12 @@ static struct cnfparamblk modpblk =
modpdescr
};
-
-
static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this module */
static prop_t *pLocalHostIP = NULL; /* a pseudo-constant propterty for 127.0.0.1 */
-
static inline void
initConfigSettings(void)
{
- cs.bPermitNonKernel = 0;
cs.console_log_level = -1;
cs.pszPath = NULL;
cs.iFacilIntMsg = klogFacilIntMsg();
@@ -109,7 +103,7 @@ initConfigSettings(void)
* rgerhards, 2008-04-12
*/
static rsRetVal
-enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity, struct timeval *tp)
+enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity, struct timeval *tp, struct json_object *json)
{
struct syslogTime st;
msg_t *pMsg;
@@ -134,6 +128,7 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity, struct timeval *
MsgSetTAG(pMsg, pszTag, ustrlen(pszTag));
pMsg->iFacility = iFacility;
pMsg->iSeverity = iSeverity;
+ pMsg->json = json;
CHKiRet(submitMsg(pMsg));
finalize_it:
@@ -160,21 +155,12 @@ rsRetVal imkmsgLogIntMsg(int priority, char *fmt, ...)
}
-/* log a kernel message. If tp is non-NULL, it contains the message creation
- * time to use.
- * rgerhards, 2008-04-14
+/* log a message from /dev/kmsg
*/
-rsRetVal Syslog(int priority, uchar *pMsg, struct timeval *tp)
+rsRetVal Syslog(int priority, uchar *pMsg, struct timeval *tp, struct json_object *json)
{
DEFiRet;
-
- // XXX - support it?
- /* ignore non-kernel messages if not permitted */
-// if(cs.bPermitNonKernel == 0 && LOG_FAC(priority) != LOG_KERN)
-// FINALIZE; /* silently ignore */
-
- iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", LOG_FAC(priority), LOG_PRI(priority), tp);
-
+ iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", LOG_FAC(priority), LOG_PRI(priority), tp, json);
RETiRet;
}
@@ -244,8 +230,6 @@ CODESTARTsetModCnf
continue;
if(!strcmp(modpblk.descr[i].name, "logpath")) {
loadModConf->pszPath = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
- } else if(!strcmp(modpblk.descr[i].name, "permitnonkernelfacility")) {
- loadModConf->bPermitNonKernel = (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "consoleloglevel")) {
loadModConf->console_log_level= (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "internalmsgfacility")) {
@@ -270,7 +254,6 @@ BEGINendCnfLoad
CODESTARTendCnfLoad
if(!loadModConf->configSetViaV2Method) {
/* persist module-specific settings from legacy config system */
- loadModConf->bPermitNonKernel = cs.bPermitNonKernel;
loadModConf->iFacilIntMsg = cs.iFacilIntMsg;
loadModConf->console_log_level = cs.console_log_level;
if((cs.pszPath == NULL) || (cs.pszPath[0] == '\0')) {
@@ -346,7 +329,6 @@ ENDqueryEtryPt
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
- cs.bPermitNonKernel = 0;
if(cs.pszPath != NULL) {
free(cs.pszPath);
cs.pszPath = NULL;
@@ -382,8 +364,6 @@ CODEmodInit_QueryRegCFSLineHdlr
NULL, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogusesyscallinterface", 0, eCmdHdlrGoneAway,
NULL, NULL, STD_LOADABLE_MODULE_ID));
- CHKiRet(regCfSysLineHdlr2((uchar *)"klogpermitnonkernelfacility", 0, eCmdHdlrBinary,
- NULL, &cs.bPermitNonKernel, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(regCfSysLineHdlr2((uchar *)"klogconsoleloglevel", 0, eCmdHdlrInt,
NULL, &cs.console_log_level, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(regCfSysLineHdlr2((uchar *)"kloginternalmsgfacility", 0, eCmdHdlrFacility,