summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhuang Yuyao <netone.z@gmail.com>2008-09-10 12:18:34 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-09-10 12:18:34 +0200
commitd65470842d1455fd335fcd62e54aed01628a2af6 (patch)
tree9199c9c35243a43f08f50fabfc090986157cbe2e
parentae425d47c53da7ba669b7c6fbe48381eda83180a (diff)
downloadrsyslog-d65470842d1455fd335fcd62e54aed01628a2af6.tar.gz
rsyslog-d65470842d1455fd335fcd62e54aed01628a2af6.tar.xz
rsyslog-d65470842d1455fd335fcd62e54aed01628a2af6.zip
added new capability to property replacer.
Multiple immediately successive field delimiters are treated as a single one. Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
-rw-r--r--ChangeLog3
-rw-r--r--runtime/msg.c5
-rw-r--r--template.c5
-rw-r--r--template.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fe6ed84f..62b84500 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 3.21.5 [DEVEL] (rgerhards), 2008-09-??
+- added new capability to property replacer: multiple immediately
+ successive field delimiters are treated as a single one.
+ Thanks to Zhuang Yuyao for the patch.
---------------------------------------------------------------------------
Version 3.21.4 [DEVEL] (rgerhards), 2008-09-04
- removed compile time fixed message size limit (was 2K), limit can now
diff --git a/runtime/msg.c b/runtime/msg.c
index fdeae077..28cb235a 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1809,6 +1809,11 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
++pFld; /* skip to field terminator */
if(*pFld == pTpe->data.field.field_delim) {
++pFld; /* eat it */
+ if (pTpe->data.field.field_expand != 0) {
+ while (*pFld == pTpe->data.field.field_delim) {
+ ++pFld;
+ }
+ }
++iCurrFld;
}
}
diff --git a/template.c b/template.c
index 2fe23710..79167667 100644
--- a/template.c
+++ b/template.c
@@ -603,6 +603,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* now we fall through the "regular" FromPos code */
#endif /* #ifdef FEATURE_REGEXP */
if(*p == 'F') {
+ pTpe->data.field.field_expand = 0;
/* we have a field counter, so indicate it in the template */
++p; /* eat 'F' */
if (*p == ':') {
@@ -630,7 +631,11 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
pTpe->data.field.field_delim = 9;
} else {
pTpe->data.field.field_delim = iNum;
+ if (*p == '+') {
+ pTpe->data.field.field_expand = 1;
+ p ++;
}
+ }
}
} else {
/* invalid character after F, so we need to reject
diff --git a/template.h b/template.h
index 6e889c58..15b700b3 100644
--- a/template.h
+++ b/template.h
@@ -84,6 +84,8 @@ struct templateEntry {
#endif
unsigned has_fields; /* support for field-counting: field to extract */
unsigned char field_delim; /* support for field-counting: field delemiter char */
+ int field_expand; /* use multiple instances of the field delimiter as a single one? */
+
enum tplFormatTypes eDateFormat;
enum tplFormatCaseConvTypes eCaseConv;
struct { /* bit fields! */