diff --git a/man/syslogd.8 b/man/syslogd.8 index 9a93b8f..dcfb564 100644 --- a/man/syslogd.8 +++ b/man/syslogd.8 @@ -296,7 +296,9 @@ facility is reserved for messages read directly from Select the number of minutes between .Dq mark messages; the default is 20 minutes. Setting this to zero disables log -marks. +marks. See the +.Sx BUGS +section for more information. .It Fl n Disable DNS query for every request. .It Fl p Ar socket @@ -622,6 +624,22 @@ from should be put early into the .Fl a list. .Pp +The mark interval, as controlled by the +.Fl m Ar INTV +option, relies on an internal timer with 30 second granularity. Every +30 seconds +.Nm +will attempt to log the text +.Cd "-- MARK --" +with (the internal) facility +.Cd mark +and priority +.Cd info . +Every log target is traversed, if at least +.Ar INTV +minutes have passed since the log target was written to, the mark is +logged. Hence, it may be off by up to 30 seconds, this is by design. +.Pp As mentioned in the .Sx DESCRIPTION , .Nm diff --git a/src/syslogd.c b/src/syslogd.c index b63e030..0d8a3d7 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -585,13 +585,8 @@ no_klogd: /* * Set up timer callbacks for -- MARK -- et al */ - if (MarkInterval > 0) { - int interval = MarkInterval / 2; - - if (interval < 30) - interval = 30; - timer_add(interval, domark, NULL); - } + if (MarkInterval > 0) + timer_add(TIMERINTVL, domark, NULL); timer_add(TIMERINTVL, doflush, NULL); /* Start 'em */ @@ -1674,11 +1669,7 @@ static void logmsg(struct buf_msg *buffer) /* don't output marks to recently written files */ if (buffer->flags & MARK) { - time_t t_now = timer_now(); - - if (f->f_time + MarkInterval > t_now) - continue; - if (t_now - f->f_time < MarkInterval / 2) + if (timer_now() - f->f_time < MarkInterval) continue; } @@ -2423,14 +2414,7 @@ static void forw_lookup(struct filed *f) void domark(void *arg) { - 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; - } + flog(INTERNAL_MARK | LOG_INFO, "-- MARK --"); } void doflush(void *arg)