patches and docu update for 1.19.3

This commit is contained in:
Michael Meckelein 2007-08-31 12:47:35 +00:00
parent a24b9f9127
commit 262111689f
9 changed files with 92 additions and 23 deletions

View File

@ -1,6 +1,11 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Version 1.19.3 (rgerhards), 2007-? Version 1.19.3 (rgerhards), 2007-08-31
- ... - small mem leak fixed (after calling parseSelectorAct) - Thx varmojkekoj
- documentation section "Regular File" und "Blocks" updated
- solved an issue with dynamic file generation - Once again many thanks
to varmojfekoj
- the negative selector for program name filter (Blocks) does not work as
expected - Thanks varmojfekoj for patching
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Version 1.19.2 (rgerhards), 2007-08-28 Version 1.19.2 (rgerhards), 2007-08-28
- a specifically formed message caused a segfault - Many thanks varmojfekoj - a specifically formed message caused a segfault - Many thanks varmojfekoj

View File

@ -214,10 +214,14 @@ then the second block will only log messages from the ppp program on dialhost.
<p>A program specification is a line beginning with !prog and the following <p>A program specification is a line beginning with !prog and the following
blocks will be associated with calls to syslog from that specific program. A blocks will be associated with calls to syslog from that specific program. A
program specification for foo will also match any message logged by the kernel program specification for foo will also match any message logged by the kernel
with the prefix foo: . A hostname specification of the form +hostname and with the prefix foo: . Alternatively, a program specification -foo causes the
following blocks to be applied to messages from any program but the one specified.
A hostname specification of the form +hostname and
the following blocks will be applied to messages received from the specified the following blocks will be applied to messages received from the specified
hostname. Alternatively, a hostname specification -hostname causes the hostname. Alternatively, a hostname specification -hostname causes the
following blocks to be applied to messages from any host but the one specified. following blocks to be applied to messages from any host but the one specified.
If the hostname is given as @, the local hostname will be used. (NOT YET If the hostname is given as @, the local hostname will be used. (NOT YET
IMPLEMENTED) A program or hostname specification may be reset by giving the IMPLEMENTED) A program or hostname specification may be reset by giving the
program or hostname as *.</p> program or hostname as *.</p>
@ -410,24 +414,27 @@ name. An example can be seen above in the description of template. We will use
the &quot;DynFile&quot; template defined there. Dynamic filenames are indicated by the &quot;DynFile&quot; template defined there. Dynamic filenames are indicated by
specifying a questions mark &quot;?&quot; instead of a slash, followed by the template specifying a questions mark &quot;?&quot; instead of a slash, followed by the template
name. Thus, the selector line for our dynamic file name would look as follows:</p> name. Thus, the selector line for our dynamic file name would look as follows:</p>
<p align="center"> <blockquote>
<code>*.* ?DynFile</code> <code>*.* ?DynFile</code>
</p> </blockquote>
<p>That's all you need to do. Rsyslog will now automatically generate file names <p>That's all you need to do. Rsyslog will now automatically generate file names
for you and store the right messages into the right files. Please note that the for you and store the right messages into the right files. Please note that the
minus sign also works with dynamic file name selectors. Thus, to avoid syncing, minus sign also works with dynamic file name selectors. Thus, to avoid syncing,
you may use</p> you may use</p>
<p align="center"> <blockquote>
<code>*.* -?DynFile</code></p> <code>*.* -?DynFile</code></blockquote>
<p>And of course you can use templates to specify the output format:</p> <p>And of course you can use templates to specify the output format:</p>
<p align="center"> <blockquote>
<code>*.* ?DynFile;MyTemplate</code></p> <code>*.* ?DynFile;MyTemplate</code></blockquote>
<p><b>A word of caution:</b> rsyslog creates files as needed. So if a new host <p><b>A word of caution:</b> rsyslog creates files as needed. So if a new host
is using your syslog server, rsyslog will automatically create a new file for is using your syslog server, rsyslog will automatically create a new file for
it. <b>However, directories are never created</b>. So if you use a dynamic it.</p>
directory name, you must make sure that all possible directories are created,
otherwise the writes will fail. This restriction will most probably be removed <p><b>Creating directories is also supported</b>. For example you can use the hostname as directory
in later versions of rsyslogd.</p> and the program name as file name:</p>
<blockquote>
<code>$template DynFile,"/var/log/%HOSTNAME%/%programname%.log"</code></blockquote>
<h3>Named Pipes</h3> <h3>Named Pipes</h3>
<p>This version of rsyslogd(8) has support for logging output to named pipes (fifos). <p>This version of rsyslogd(8) has support for logging output to named pipes (fifos).
A fifo or named pipe can be used as a destination for log messages by prepending A fifo or named pipe can be used as a destination for log messages by prepending
@ -806,4 +813,4 @@ defining such features is available
in rsyslogd, only.<br> in rsyslogd, only.<br>
&nbsp;</p> &nbsp;</p>
</body> </body>
</html> </html>

View File

@ -4,11 +4,11 @@
</head> </head>
<body> <body>
<h2>rsyslog status page</h2> <h2>rsyslog status page</h2>
<p>This page reflects the status as of 2007-08-28.</p> <p>This page reflects the status as of 2007-08-31.</p>
<h2>Current Releases</h2> <h2>Current Releases</h2>
<p><b>development:</b> 1.19.2 - <p><b>development:</b> 1.19.3 -
<a href="http://www.rsyslog.com/Article119.phtml">change log</a> - <a href="http://www.rsyslog.com/Article121.phtml">change log</a> -
<a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-54.phtml">download</a></p> <a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-55.phtml">download</a></p>
<p><b>stable:</b> 1.0.5 - <a href="http://www.rsyslog.com/Article85.phtml">change log</a> - <p><b>stable:</b> 1.0.5 - <a href="http://www.rsyslog.com/Article85.phtml">change log</a> -
<a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-39.phtml">download</a></p> <a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-39.phtml">download</a></p>
<p>&nbsp;(<a href="version_naming.html">How are versions named?</a>)</p> <p>&nbsp;(<a href="version_naming.html">How are versions named?</a>)</p>

39
msg.c
View File

@ -1606,6 +1606,45 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
} }
} }
/* Take care of spurious characters to make the property safe
* for a path definition
*/
if(pTpe->data.field.options.bSecPathDrop || pTpe->data.field.options.bSecPathReplace) {
if(pTpe->data.field.options.bSecPathDrop) {
char *pSrc = pRes;
char *pDst = pRes;
while(*pSrc) {
if(*pSrc != '/')
*pDst++ = *pSrc;
pSrc++;
}
*pDst = '\0';
} else {
char *pB = pRes;
while(*pB) {
if(*pB == '/')
*pB = '_';
pB++;
}
}
if(*pRes == '.' && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0')))
*pRes = '_';
if(*pRes == '\0') {
if(*pbMustBeFreed == 1)
free(pRes);
pRes = malloc(2);
if(pRes == NULL) {
*pbMustBeFreed = 0;
return "**OUT OF MEMORY ALLOCATING pBuf**";
}
*pRes = '_';
*(pRes + 1) = '\0';
*pbMustBeFreed = 1;
}
}
/* Now drop last LF if present (pls note that this must not be done /* Now drop last LF if present (pls note that this must not be done
* if bEscapeCC was set! * if bEscapeCC was set!
*/ */

View File

@ -714,7 +714,7 @@ CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(1) CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(*p == '@') { if(*p == '@') {
if((iRet = createInstance(&pData)) != RS_RET_OK) if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet; goto finalize_it;
++p; /* eat '@' */ ++p; /* eat '@' */
if(*p == '@') { /* indicator for TCP! */ if(*p == '@') { /* indicator for TCP! */
pData->protocol = FORW_TCP; pData->protocol = FORW_TCP;
@ -837,7 +837,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* process template */ /* process template */
if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " StdFwdFmt")) if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " StdFwdFmt"))
!= RS_RET_OK) != RS_RET_OK)
return iRet; goto finalize_it;
/* first set the pData->eDestState */ /* first set the pData->eDestState */
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));

View File

@ -99,7 +99,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
*/ */
if(*p == '^') { if(*p == '^') {
if((iRet = createInstance(&pData)) != RS_RET_OK) if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet; goto finalize_it;
} }

View File

@ -2302,8 +2302,20 @@ int shouldProcessThisMessage(selector_t *f, msg_t *pMsg)
} }
if(f->pCSProgNameComp != NULL) { if(f->pCSProgNameComp != NULL) {
if(rsCStrSzStrCmp(f->pCSProgNameComp, (uchar*) getProgramName(pMsg), getProgramNameLen(pMsg))) { int bInv = 0, bEqv = 0, offset = 0;
/* not equal, so we are already done... */ if(*(rsCStrGetSzStr(f->pCSProgNameComp)) == '-') {
if(*(rsCStrGetSzStr(f->pCSProgNameComp) + 1) == '-')
offset = 1;
else {
bInv = 1;
offset = 1;
}
}
if(!rsCStrOffsetSzStrCmp(f->pCSProgNameComp, offset, (uchar*) getProgramName(pMsg), getProgramNameLen(pMsg)))
bEqv = 1;
if((!bEqv && !bInv) || (bEqv && bInv)) {
/* not equal or inverted selection, so we are already done... */
dbgprintf("programname filter '%s' does not match '%s'\n", dbgprintf("programname filter '%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSProgNameComp), getProgramName(pMsg)); rsCStrGetSzStr(f->pCSProgNameComp), getProgramName(pMsg));
return 0; return 0;

View File

@ -432,6 +432,10 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
pTpe->data.field.options.bSpaceCC = 1; pTpe->data.field.options.bSpaceCC = 1;
} else if(!strcmp((char*)Buf, "drop-last-lf")) { } else if(!strcmp((char*)Buf, "drop-last-lf")) {
pTpe->data.field.options.bDropLastLF = 1; pTpe->data.field.options.bDropLastLF = 1;
} else if(!strcmp((char*)Buf, "secpath-drop")) {
pTpe->data.field.options.bSecPathDrop = 1;
} else if(!strcmp((char*)Buf, "secpath-replace")) {
pTpe->data.field.options.bSecPathReplace = 1;
} else { } else {
dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf); dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf);
} }

View File

@ -65,6 +65,8 @@ struct templateEntry {
unsigned bSpaceCC: 1; /* change control characters to spaceescape? */ unsigned bSpaceCC: 1; /* change control characters to spaceescape? */
unsigned bEscapeCC: 1; /* escape control characters? */ unsigned bEscapeCC: 1; /* escape control characters? */
unsigned bDropLastLF: 1; /* drop last LF char in msg (PIX!) */ unsigned bDropLastLF: 1; /* drop last LF char in msg (PIX!) */
unsigned bSecPathDrop: 1; /* drop slashes, replace dots, empty string */
unsigned bSecPathReplace: 1; /* replace slashes, replace dots, empty string */
} options; /* options as bit fields */ } options; /* options as bit fields */
} field; } field;
} data; } data;