busybox/sysklogd
Peter Korsgaard 9d539f9fbd sysklogd: add timestamp option to ignore message timestamps
Some syslog producers provide inconsistent timestamps, so provide an option
to ignore the message timestamps and always locally timestamp.  In order to
implement this, invert the valid-timestamp check, but only use the timestamp
if this option is not enabled.

This is in line with what what other syslogd implementations do:

From sysklogd syslogd.c:
 * Sun Nov  7 12:28:47 CET 2004: Martin Schulze <joey@infodrom.org>
 *      Discard any timestamp information found in received syslog
 *      messages.  This will affect local messages sent from a
 *      different timezone.

rsyslog's imuxsock module similary has an (enabled by default)
IgnoreTimestamp option:

https://www.rsyslog.com/doc/v8-stable/configuration/modules/imuxsock.html

function                                             old     new   delta
packed_usage                                       32877   32912     +35
timestamp_and_log                                    363     376     +13
syslogd_main                                        1638    1641      +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 51/0)               Total: 51 bytes

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-26 17:31:21 +02:00
..
Config.src restore documentation on the build config language 2018-06-06 15:16:48 +02:00
Kbuild.src
klogd.c klogd: code shrink 2018-07-31 16:50:26 +02:00
logger.c syslogd,logger: code shrink for musl 2017-08-16 15:05:36 +02:00
logread.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
syslogd_and_logger.c use gmtime_r() instead of gmtime() 2018-03-06 18:11:47 +01:00
syslogd.c sysklogd: add timestamp option to ignore message timestamps 2018-08-26 17:31:21 +02:00