summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-15 16:04:18 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-15 16:04:18 +0000
commit05448d89a3c7ee0a43ae5789e47c51524492009d (patch)
tree1621d9ca1a45c1916a1f9d1e48db51c0dc786e7f
parentc31e6fbeffd36316760e8db19b37af3d135b17c2 (diff)
downloadrsyslog-05448d89a3c7ee0a43ae5789e47c51524492009d.tar.gz
rsyslog-05448d89a3c7ee0a43ae5789e47c51524492009d.tar.xz
rsyslog-05448d89a3c7ee0a43ae5789e47c51524492009d.zip
implemented $RepeatedLineReduction option
-rw-r--r--syslogd-types.h1
-rw-r--r--syslogd.c10
2 files changed, 8 insertions, 3 deletions
diff --git a/syslogd-types.h b/syslogd-types.h
index ae0f8a7e..2ae0964a 100644
--- a/syslogd-types.h
+++ b/syslogd-types.h
@@ -262,6 +262,7 @@ struct filed {
char *f_sizeLimitCmd; /* command to carry out when size limit is reached */
} f_file;
} f_un;
+ int f_ReduceRepeated; /* reduce repeated lines 0 - no, 1 - yes */
int f_prevcount; /* repetition cnt of prevline */
int f_repeatcount; /* number of "repeated" msgs */
int f_flags; /* store some additional flags */
diff --git a/syslogd.c b/syslogd.c
index 554b8300..ef6db26b 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -4755,7 +4755,7 @@ static void processMsg(msg_t *pMsg)
/* suppress duplicate lines to this file
*/
- if ((logEveryMsg == 0) &&
+ if ((f->f_ReduceRepeated == 1) &&
(pMsg->msgFlags & MARK) == 0 && getMSGLen(pMsg) == getMSGLen(f->f_pMsg) &&
!strcmp(getMSG(pMsg), getMSG(f->f_pMsg)) &&
!strcmp(getHOSTNAME(pMsg), getHOSTNAME(f->f_pMsg))) {
@@ -7573,8 +7573,7 @@ static void init()
if(Debug) {
printf("Active selectors:\n");
for (f = Files; f != NULL ; f = f->f_next) {
- if (1) {
- //if (f->f_type != F_UNUSED) {
+ if (f->f_type != F_UNUSED) {
if(f->pCSProgNameComp != NULL)
printf("tag: '%s'\n", rsCStrGetSzStr(f->pCSProgNameComp));
if(f->eHostnameCmpMode != HN_NO_COMP)
@@ -7632,6 +7631,8 @@ static void init()
printf("%s, ", f->f_un.f_uname[i]);
break;
}
+ if(f->f_ReduceRepeated)
+ printf(" [RepeatedLineReduction]");
printf("\n");
}
}
@@ -8295,6 +8296,9 @@ static rsRetVal cfline(char *line, register selector_t *f)
return iRet;
}
+ /* common properties */
+ f->f_ReduceRepeated = bReduceRepeatMsgs;
+
/* we now check if there are some global (BSD-style) filter conditions
* and, if so, we copy them over. rgerhards, 2005-10-18
*/