if (!rl->n_dropped) {
rl->first_dropped = now;
}
+ rl->last_dropped = now;
rl->n_dropped++;
return true;
}
rl->tokens -= VLOG_MSG_TOKENS;
if (rl->n_dropped) {
+ time_t now = time_now();
+ unsigned int first_dropped_elapsed = now - rl->first_dropped;
+ unsigned int last_dropped_elapsed = now - rl->last_dropped;
+
vlog(module, level,
- "Dropped %u log messages in last %u seconds "
- "due to excessive rate",
- rl->n_dropped, (unsigned int) (time_now() - rl->first_dropped));
+ "Dropped %u log messages in last %u seconds (most recently, "
+ "%u seconds ago) due to excessive rate",
+ rl->n_dropped, first_dropped_elapsed, last_dropped_elapsed);
+
rl->n_dropped = 0;
}
return false;
unsigned int tokens; /* Current number of tokens. */
time_t last_fill; /* Last time tokens added. */
time_t first_dropped; /* Time first message was dropped. */
+ time_t last_dropped; /* Time of most recent message drop. */
unsigned int n_dropped; /* Number of messages dropped. */
};
0, /* tokens */ \
0, /* last_fill */ \
0, /* first_dropped */ \
+ 0, /* last_dropped */ \
0, /* n_dropped */ \
}