summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
authorTomas Heinrich <theinric@redhat.com>2012-01-10 17:14:16 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-01-10 17:14:16 +0100
commita2e69cffff21ad433e61b45f91a2be4d5ebc5c72 (patch)
tree4b7ae7d2abf38ff1a39d1494da873b6393a508f9 /tools/syslogd.c
parente25dc05e9127537cf2ddbae30b15300f601fbff0 (diff)
downloadrsyslog-a2e69cffff21ad433e61b45f91a2be4d5ebc5c72.tar.gz
rsyslog-a2e69cffff21ad433e61b45f91a2be4d5ebc5c72.tar.xz
rsyslog-a2e69cffff21ad433e61b45f91a2be4d5ebc5c72.zip
added $SpaceLFOnReceive config directive
Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 4a5cbf60..b696c55f 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -259,6 +259,7 @@ static int bDebugPrintCfSysLineHandlerList = 1;/* output cfsyslinehandler list i
static int bDebugPrintModuleList = 1;/* output module list in debug mode? */
uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence for control chars */
int bEscapeCCOnRcv = 1; /* escape control characters on reception: 0 - no, 1 - yes */
+int bSpaceLFOnRcv = 0; /* replace newlines with spaces on reception: 0 - no, 1 - yes */
static int bErrMsgToStderr = 1; /* print error messages to stderr (in addition to everything else)? */
int bReduceRepeatMsgs; /* reduce repeated message - 0 - no, 1 - yes */
int bActExecWhenPrevSusp; /* execute action only when previous one was suspended? */
@@ -343,6 +344,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
bDebugPrintCfSysLineHandlerList = 1;
bDebugPrintModuleList = 1;
bEscapeCCOnRcv = 1; /* default is to escape control characters */
+ bSpaceLFOnRcv = 0;
bReduceRepeatMsgs = 0;
free(pszMainMsgQFName);
pszMainMsgQFName = NULL;
@@ -810,6 +812,9 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int fla
/* log an error? Very questionable... rgerhards, 2006-11-30 */
/* decided: we do not log an error, it won't help... rger, 2007-06-21 */
++pData;
+ } else if (bSpaceLFOnRcv && *pData == '\n') {
+ *(pMsg + iMsg++) = ' ';
+ ++pData;
} else if(bEscapeCCOnRcv && iscntrl((int) *pData)) {
/* we are configured to escape control characters. Please note
* that this most probably break non-western character sets like
@@ -2115,6 +2120,9 @@ static void dbgPrintInitInfo(void)
DBGPRINTF("Control characters are %sreplaced upon reception.\n",
bEscapeCCOnRcv? "" : "not ");
+ DBGPRINTF("Newlines are %sreplaced upon reception.\n",
+ bSpaceLFOnRcv? "" : "not ");
+
if(bEscapeCCOnRcv)
DBGPRINTF("Control character escape sequence prefix is '%c'.\n",
cCCEscapeChar);
@@ -2728,6 +2736,7 @@ static rsRetVal loadBuildInModules(void)
CHKiRet(regCfSysLineHdlr((uchar *)"actionresumeinterval", 0, eCmdHdlrInt, setActionResumeInterval, NULL, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"controlcharacterescapeprefix", 0, eCmdHdlrGetChar, NULL, &cCCEscapeChar, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"escapecontrolcharactersonreceive", 0, eCmdHdlrBinary, NULL, &bEscapeCCOnRcv, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"spacelfonreceive", 0, eCmdHdlrBinary, NULL, &bSpaceLFOnRcv, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"droptrailinglfonreception", 0, eCmdHdlrBinary, NULL, &bDropTrailingLF, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"template", 0, eCmdHdlrCustomHandler, conf.doNameLine, (void*)DIR_TEMPLATE, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"outchannel", 0, eCmdHdlrCustomHandler, conf.doNameLine, (void*)DIR_OUTCHANNEL, NULL));