From 05448d89a3c7ee0a43ae5789e47c51524492009d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 15 Jul 2007 16:04:18 +0000 Subject: implemented $RepeatedLineReduction option --- syslogd-types.h | 1 + syslogd.c | 10 +++++++--- 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 */ -- cgit v1.2.3