summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-11-11 10:07:52 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2008-11-11 10:07:52 +0100
commitc291d8baca323e26cd63e5d26b50f3b2247fac78 (patch)
tree550012a422dc6d33907556fb8708af97ea484de8
parentb4729996790c0f7a0b2758d9ee809b7cc10dec8f (diff)
downloadrsyslog-c291d8baca323e26cd63e5d26b50f3b2247fac78.tar.gz
rsyslog-c291d8baca323e26cd63e5d26b50f3b2247fac78.tar.xz
rsyslog-c291d8baca323e26cd63e5d26b50f3b2247fac78.zip
improved debug output for regular expressions inside property replacer
RE's seem to be a big trouble spot and I would like to have more information inside the debug log. So I decided to add some additional debug strings permanently.
-rw-r--r--ChangeLog4
-rw-r--r--runtime/msg.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 688f2c99..e6a2b899 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
Version 3.20.1 [v3-stable] (rgerhards), 2008-11-??
- doc update: documented how to specify multiple property replacer
options + link to new online regex generator tool added
+- improved debug output for regular expressions inside property replacer
+ RE's seem to be a big trouble spot and I would like to have more
+ information inside the debug log. So I decided to add some additional
+ debug strings permanently.
---------------------------------------------------------------------------
Version 3.20.0 [v3-stable] (rgerhards), 2008-11-05
- this is the inital release of the 3.19.x branch as a stable release
diff --git a/runtime/msg.c b/runtime/msg.c
index fdeae077..fcd4a6d3 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1906,7 +1906,10 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
* potential matches over the string.
*/
while(!bFound) {
- if(regexp.regexec(&pTpe->data.field.re, pRes + iOffs, nmatch, pmatch, 0) == 0) {
+ int iREstat;
+ iREstat = regexp.regexec(&pTpe->data.field.re, pRes + iOffs, nmatch, pmatch, 0);
+ dbgprintf("regexec return is %d\n", iREstat);
+ if(iREstat == 0) {
if(pmatch[0].rm_so == -1) {
dbgprintf("oops ... start offset of successful regexec is -1\n");
break;
@@ -1914,6 +1917,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
if(iTry == pTpe->data.field.iMatchToUse) {
bFound = 1;
} else {
+ dbgprintf("regex found at offset %d, new offset %d, tries %d\n",
+ iOffs, iOffs + pmatch[0].rm_eo, iTry);
iOffs += pmatch[0].rm_eo;
++iTry;
}
@@ -1921,6 +1926,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
break;
}
}
+ dbgprintf("regex: end search, found %d\n", bFound);
if(!bFound) {
/* we got no match! */
if(pTpe->data.field.nomatchAction != TPL_REGEX_NOMATCH_USE_WHOLE_FIELD) {