diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-26 18:45:12 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-26 18:45:12 +0200 |
commit | df5c3b8cddc01d122df63e20e36272af67f2ac3c (patch) | |
tree | 63a222ea5b75bae83c11b220db207d7603989023 /plugins/imklog | |
parent | 19c8bed08dbeb9ce0313ec92d7de85c9c51c4f48 (diff) | |
parent | 415b95cf453403f726f654cbc03ef3984446a870 (diff) | |
download | rsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.tar.gz rsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.tar.xz rsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.zip |
Merge branch 'v5-devel'
Conflicts:
tools/omfile.c
Diffstat (limited to 'plugins/imklog')
-rw-r--r-- | plugins/imklog/imklog.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index 79f485c5..568fa8c1 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -186,12 +186,28 @@ rsRetVal imklogLogIntMsg(int priority, char *fmt, ...) rsRetVal Syslog(int priority, uchar *pMsg) { DEFiRet; + int pri = -1; rsRetVal localRet; - /* Output using syslog */ - localRet = parsePRI(&pMsg, &priority); - if(localRet != RS_RET_INVALID_PRI && localRet != RS_RET_OK) - FINALIZE; + /* first check if we have two PRIs. This can happen in case of systemd, + * in which case the second PRI is the rigth one. + * TODO: added kernel timestamp support to this PoC. -- rgerhards, 2011-03-18 + */ + if(pMsg[3] == '<') { /* could be a pri... */ + uchar *pMsgTmp = pMsg + 3; + localRet = parsePRI(&pMsgTmp, &pri); + if(localRet == RS_RET_OK && pri >= 8 && pri <= 192) { + /* *this* is our PRI */ + DBGPRINTF("imklog detected secondary PRI in klog msg\n"); + pMsg = pMsgTmp; + priority = pri; + } + } + if(pri == -1) { + localRet = parsePRI(&pMsg, &priority); + if(localRet != RS_RET_INVALID_PRI && localRet != RS_RET_OK) + FINALIZE; + } /* if we don't get the pri, we use whatever we were supplied */ /* ignore non-kernel messages if not permitted */ |