summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-04-19 17:13:08 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-04-19 17:13:08 +0200
commitd3eb89a5fe1dbcda028c0ab5e6753578716539d7 (patch)
tree9a6da2266542fb772bc996b6d245403ecdfd126c
parent4e511087c413629120315fe5dd26f966ac1ef6fb (diff)
parent587036bfb03167d86b0a2fbfe998db1a916cabb3 (diff)
downloadrsyslog-d3eb89a5fe1dbcda028c0ab5e6753578716539d7.tar.gz
rsyslog-d3eb89a5fe1dbcda028c0ab5e6753578716539d7.tar.xz
rsyslog-d3eb89a5fe1dbcda028c0ab5e6753578716539d7.zip
Merge branch 'v4-devel' into master
Conflicts: runtime/msg.h
-rw-r--r--plugins/imsolaris/imsolaris.c22
-rw-r--r--runtime/msg.h1
-rw-r--r--runtime/parser.c29
-rw-r--r--tools/ompipe.c1
4 files changed, 24 insertions, 29 deletions
diff --git a/plugins/imsolaris/imsolaris.c b/plugins/imsolaris/imsolaris.c
index a2238a29..e591b875 100644
--- a/plugins/imsolaris/imsolaris.c
+++ b/plugins/imsolaris/imsolaris.c
@@ -127,7 +127,6 @@ solaris_readLog(int fd)
uchar bufRcv[4096+1];
uchar *pRcv = NULL; /* receive buffer */
char errStr[1024];
- uchar fmtBuf[10240]; // TODO: use better solution
assert(logfd >= 0);
@@ -158,32 +157,21 @@ solaris_readLog(int fd)
dbgprintf("imsolaris: getmsg() returns %d\n", ret);
dbgprintf("imsolaris: message from log socket: #%d: %s\n", fd, pRcv);
if (1) {//iRcvd > 0) {
- // TODO: use hdr info! This whole section is a work-around to get
- // it going.
-#if 0
CHKiRet(msgConstruct(&pMsg));
//MsgSetFlowControlType(pMsg, eFLOWCTL_FULL_DELAY);
MsgSetInputName(pMsg, pInputName);
MsgSetRawMsg(pMsg, (char*)pRcv, strlen((char*)pRcv));
- MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
- //MsgSetTAG(pMsg, pInfo->pszTag, pInfo->lenTag);
- //pMsg->iFacility = LOG_FAC(pInfo->iFacility);
- //pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
- pMsg->bParseHOSTNAME = 0;
+ pMsg->iFacility = LOG_FAC(hdr.pri);
+ pMsg->iSeverity = LOG_PRI(hdr.pri);
+ //pMsg->bParseHOSTNAME = 0;
+ pMsg->msgFlags = NEEDS_PARSING | NO_PRI_IN_RAW;
CHKiRet(submitMsg(pMsg));
-#else
- iRcvd = snprintf((char*)fmtBuf, sizeof(fmtBuf), "<%d>%s", hdr.pri, (char*) pRcv);
- parseAndSubmitMessage(glbl.GetLocalHostName(),
- (uchar*)"127.0.0.1", fmtBuf,
- iRcvd, 0,
- 0, pInputName, NULL, 0);
-#endif
} else if (iRcvd < 0 && errno != EINTR) {
int en = errno;
rs_strerror_r(en, errStr, sizeof(errStr));
dbgprintf("imsolaris: stream error: %d = %s.\n", errno, errStr);
- //errmsg.LogError(en, NO_ERRCODE, "imsolaris: socket error UNIX");
+ errmsg.LogError(en, NO_ERRCODE, "imsolaris: stream input error: %s", errStr);
}
finalize_it:
diff --git a/runtime/msg.h b/runtime/msg.h
index b4b6d9f8..712609f6 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -129,6 +129,7 @@ struct msg {
#define PARSE_HOSTNAME 0x020 /* parse the hostname during message parsing */
#define NEEDS_DNSRESOL 0x040 /* fromhost address is unresolved and must be locked up via DNS reverse lookup first */
#define NEEDS_ACLCHK_U 0x080 /* check UDP ACLs after DNS resolution has been done in main queue consumer */
+#define NO_PRI_IN_RAW 0x100 /* rawmsg does not include a PRI (Solaris!), but PRI is already set correctly in the msg object */
/* function prototypes
diff --git a/runtime/parser.c b/runtime/parser.c
index 6238fa64..c85750dc 100644
--- a/runtime/parser.c
+++ b/runtime/parser.c
@@ -437,19 +437,24 @@ ParsePRI(msg_t *pMsg)
msg = pMsg->pszRawMsg;
pri = DEFUPRI;
iPriText = 0;
- if(*msg == '<') {
- /* while we process the PRI, we also fill the PRI textual representation
- * inside the msg object. This may not be ideal from an OOP point of view,
- * but it offers us performance...
- */
- pri = 0;
- while(--lenMsg > 0 && isdigit((int) *++msg)) {
- pri = 10 * pri + (*msg - '0');
+ if(pMsg->msgFlags & NO_PRI_IN_RAW) {
+ /* In this case, simply do so as if the pri would be right at top */
+ MsgSetAfterPRIOffs(pMsg, 0);
+ } else {
+ if(*msg == '<') {
+ /* while we process the PRI, we also fill the PRI textual representation
+ * inside the msg object. This may not be ideal from an OOP point of view,
+ * but it offers us performance...
+ */
+ pri = 0;
+ while(--lenMsg > 0 && isdigit((int) *++msg)) {
+ pri = 10 * pri + (*msg - '0');
+ }
+ if(*msg == '>')
+ ++msg;
+ if(pri & ~(LOG_FACMASK|LOG_PRIMASK))
+ pri = DEFUPRI;
}
- if(*msg == '>')
- ++msg;
- if(pri & ~(LOG_FACMASK|LOG_PRIMASK))
- pri = DEFUPRI;
}
pMsg->iFacility = LOG_FAC(pri);
pMsg->iSeverity = LOG_PRI(pri);
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 40e9e79b..cf22bc84 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>