syslogd: Only log INTERNAL_MARK every MarkInterval
Internal log messages of INTERNAL_MARK time were created every 30 seconds (TIMERINTVL) instead of every MarkInterval (default 20 min). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
7ee7df058b
commit
e0c2d3ad0d
@ -401,9 +401,14 @@ int main(int argc, char *argv[])
|
||||
/*
|
||||
* Set up timer callbacks for -- MARK -- et al
|
||||
*/
|
||||
if (MarkInterval > 0)
|
||||
timer_add(TIMERINTVL, domark, NULL);
|
||||
timer_add(FLUSHINTVL, doflush, NULL);
|
||||
if (MarkInterval > 0) {
|
||||
int interval = MarkInterval / 2;
|
||||
|
||||
if (interval < 30)
|
||||
interval = 30;
|
||||
timer_add(interval, domark, NULL);
|
||||
}
|
||||
timer_add(TIMERINTVL, doflush, NULL);
|
||||
|
||||
/* Start 'em */
|
||||
timer_start();
|
||||
@ -1896,7 +1901,14 @@ static void forw_lookup(struct filed *f)
|
||||
|
||||
void domark(void *arg)
|
||||
{
|
||||
flog(INTERNAL_MARK | LOG_INFO, "-- MARK --");
|
||||
static time_t t_last = 0;
|
||||
time_t t_now;
|
||||
|
||||
t_now = timer_now();
|
||||
if (t_now >= t_last + MarkInterval) {
|
||||
flog(INTERNAL_MARK | LOG_INFO, "-- MARK --");
|
||||
t_last = t_now;
|
||||
}
|
||||
}
|
||||
|
||||
void doflush(void *arg)
|
||||
|
@ -51,8 +51,7 @@
|
||||
#define MAXSVLINE MAXLINE /* maximum saved line length */
|
||||
#define DEFUPRI (LOG_USER | LOG_NOTICE)
|
||||
#define DEFSPRI (LOG_KERN | LOG_CRIT)
|
||||
#define TIMERINTVL 30 /* interval for checking flush, mark */
|
||||
#define FLUSHINTVL 10 /* interval for checking flush, mark */
|
||||
#define TIMERINTVL 30 /* interval for checking flush/nslookip */
|
||||
#define RCVBUF_MINSIZE (80 * MAXLINE) /* minimum size of dgram rcv buffer */
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user