summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Meckelein <mmeckelein@hq.adiscon.com>2007-08-31 12:47:35 +0000
committerMichael Meckelein <mmeckelein@hq.adiscon.com>2007-08-31 12:47:35 +0000
commit262111689f19e362100236a37bcd3c7eed6fd769 (patch)
tree01f0b34b500c858c0c45531a622bbd6368bf565e
parenta24b9f9127f48c7ff7511288ac93f613198892a6 (diff)
downloadrsyslog-262111689f19e362100236a37bcd3c7eed6fd769.tar.gz
rsyslog-262111689f19e362100236a37bcd3c7eed6fd769.tar.xz
rsyslog-262111689f19e362100236a37bcd3c7eed6fd769.zip
patches and docu update for 1.19.3v1-19-3
-rw-r--r--ChangeLog9
-rw-r--r--doc/rsyslog_conf.html31
-rw-r--r--doc/status.html8
-rw-r--r--msg.c39
-rw-r--r--omfwd.c4
-rw-r--r--omshell.c2
-rw-r--r--syslogd.c16
-rw-r--r--template.c4
-rw-r--r--template.h2
9 files changed, 92 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 1dd5da7c..38db0002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
- a specifically formed message caused a segfault - Many thanks varmojfekoj
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index 2089b87a..69760053 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -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
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
-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
hostname. Alternatively, a hostname specification ‘-hostname’ causes the
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
IMPLEMENTED) A program or hostname specification may be reset by giving the
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
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>
-<p align="center">
+<blockquote>
<code>*.* ?DynFile</code>
-</p>
+</blockquote>
<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
minus sign also works with dynamic file name selectors. Thus, to avoid syncing,
you may use</p>
-<p align="center">
-<code>*.* -?DynFile</code></p>
+<blockquote>
+<code>*.* -?DynFile</code></blockquote>
<p>And of course you can use templates to specify the output format:</p>
-<p align="center">
-<code>*.* ?DynFile;MyTemplate</code></p>
+<blockquote>
+<code>*.* ?DynFile;MyTemplate</code></blockquote>
<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
-it. <b>However, directories are never created</b>. So if you use a dynamic
-directory name, you must make sure that all possible directories are created,
-otherwise the writes will fail. This restriction will most probably be removed
-in later versions of rsyslogd.</p>
+it.</p>
+
+<p><b>Creating directories is also supported</b>. For example you can use the hostname as directory
+and the program name as file name:</p>
+<blockquote>
+<code>$template DynFile,"/var/log/%HOSTNAME%/%programname%.log"</code></blockquote>
+
<h3>Named Pipes</h3>
<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
@@ -806,4 +813,4 @@ defining such features is available
in rsyslogd, only.<br>
&nbsp;</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/doc/status.html b/doc/status.html
index 3da059d7..2487baa1 100644
--- a/doc/status.html
+++ b/doc/status.html
@@ -4,11 +4,11 @@
</head>
<body>
<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>
-<p><b>development:</b> 1.19.2 -
-<a href="http://www.rsyslog.com/Article119.phtml">change log</a> -
-<a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-54.phtml">download</a></p>
+<p><b>development:</b> 1.19.3 -
+<a href="http://www.rsyslog.com/Article121.phtml">change log</a> -
+<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> -
<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>
diff --git a/msg.c b/msg.c
index 30fe7d4e..be3c48ae 100644
--- a/msg.c
+++ b/msg.c
@@ -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
* if bEscapeCC was set!
*/
diff --git a/omfwd.c b/omfwd.c
index 096d5d78..3bfd9cc7 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -714,7 +714,7 @@ CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(*p == '@') {
if((iRet = createInstance(&pData)) != RS_RET_OK)
- return iRet;
+ goto finalize_it;
++p; /* eat '@' */
if(*p == '@') { /* indicator for TCP! */
pData->protocol = FORW_TCP;
@@ -837,7 +837,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* process template */
if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " StdFwdFmt"))
!= RS_RET_OK)
- return iRet;
+ goto finalize_it;
/* first set the pData->eDestState */
memset(&hints, 0, sizeof(hints));
diff --git a/omshell.c b/omshell.c
index ac0c9aad..54120cae 100644
--- a/omshell.c
+++ b/omshell.c
@@ -99,7 +99,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
*/
if(*p == '^') {
if((iRet = createInstance(&pData)) != RS_RET_OK)
- return iRet;
+ goto finalize_it;
}
diff --git a/syslogd.c b/syslogd.c
index 5920988c..65af51e8 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2302,8 +2302,20 @@ int shouldProcessThisMessage(selector_t *f, msg_t *pMsg)
}
if(f->pCSProgNameComp != NULL) {
- if(rsCStrSzStrCmp(f->pCSProgNameComp, (uchar*) getProgramName(pMsg), getProgramNameLen(pMsg))) {
- /* not equal, so we are already done... */
+ int bInv = 0, bEqv = 0, offset = 0;
+ 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",
rsCStrGetSzStr(f->pCSProgNameComp), getProgramName(pMsg));
return 0;
diff --git a/template.c b/template.c
index 6f2c1025..d2f2450a 100644
--- a/template.c
+++ b/template.c
@@ -432,6 +432,10 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
pTpe->data.field.options.bSpaceCC = 1;
} else if(!strcmp((char*)Buf, "drop-last-lf")) {
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 {
dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf);
}
diff --git a/template.h b/template.h
index bbd77090..3bed9c81 100644
--- a/template.h
+++ b/template.h
@@ -65,6 +65,8 @@ struct templateEntry {
unsigned bSpaceCC: 1; /* change control characters to spaceescape? */
unsigned bEscapeCC: 1; /* escape control characters? */
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 */
} field;
} data;