diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-04-17 11:10:51 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-04-17 11:10:51 +0200 |
commit | 3d914eb90cd7aed1342a01c5993f8c2de4cd1283 (patch) | |
tree | 46046d3136b5ca4fd864813b36b62d330a9c9559 /runtime/ratelimit.c | |
parent | 39b35a32b4a45ccb6506e15b02780c30ca8c3973 (diff) | |
parent | 9d59080b4a43ca6d19bece357cb1132374a2116a (diff) | |
download | rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.tar.gz rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.tar.bz2 rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.zip |
Merge branch 'master' into master-imjournal
Diffstat (limited to 'runtime/ratelimit.c')
-rw-r--r-- | runtime/ratelimit.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c index 4b618fb5..d83da2dd 100644 --- a/runtime/ratelimit.c +++ b/runtime/ratelimit.c @@ -202,7 +202,9 @@ ratelimitMsg(ratelimit_t *ratelimit, msg_t *pMsg, msg_t **ppRepMsg) DEFiRet; *ppRepMsg = NULL; - if(ratelimit->interval) { + /* Only the messages having severity level at or below the + * treshold (the value is >=) are subject to ratelimiting. */ + if(ratelimit->interval && (pMsg->iSeverity >= ratelimit->severity)) { if(withinRatelimit(ratelimit, pMsg->ttGenTime) == 0) { msgDestruct(&pMsg); ABORT_FINALIZE(RS_RET_DISCARDMSG); @@ -284,6 +286,7 @@ ratelimitNew(ratelimit_t **ppThis, char *modname, char *dynname) namebuf[sizeof(namebuf)-1] = '\0'; /* to be on safe side */ pThis->name = strdup(namebuf); } + /* pThis->severity == 0 - all messages are ratelimited */ pThis->bReduceRepeatMsgs = loadConf->globals.bReduceRepeatMsgs; *ppThis = pThis; finalize_it: @@ -316,6 +319,15 @@ ratelimitSetThreadSafe(ratelimit_t *ratelimit) pthread_mutex_init(&ratelimit->mut, NULL); } +/* Severity level determines which messages are subject to + * ratelimiting. Default (no value set) is all messages. + */ +void +ratelimitSetSeverity(ratelimit_t *ratelimit, intTiny severity) +{ + ratelimit->severity = severity; +} + void ratelimitDestruct(ratelimit_t *ratelimit) { |