From a9758d155968898dc549e1b107fa72f89ac6349b Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 29 Nov 2019 10:29:48 +0100 Subject: [PATCH] syslogd: Record time of first occurrence of a message Signed-off-by: Joachim Nilsson --- src/syslogd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/syslogd.c b/src/syslogd.c index e225a0c..d3005dc 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -1648,7 +1648,6 @@ static void fprintlog_first(struct filed *f, struct buf_msg *buffer) int iovcnt; logit("Called fprintlog_first(), "); - f->f_prevcount = 0; if (!memcmp(&buffer->timestamp, &zero, sizeof(zero))) { struct logtime timestamp_now; @@ -1662,6 +1661,9 @@ static void fprintlog_first(struct filed *f, struct buf_msg *buffer) buffer->timestamp = timestamp_now; } + f->f_time = now; + f->f_prevcount = 0; + if (f->f_flags & RFC5424) iovcnt = fmt5424(buffer, RFC5424_DATEFMT, iov, NELEMS(iov)); else if (f->f_flags & RFC3164)