From c465f340bc70f29e9af3e562fd2c7e4dbe25441f Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 13 Nov 2019 16:16:23 +0100 Subject: [PATCH] syslogd: NetBSD/FreeBSD -T option, log remote msgs with local time Signed-off-by: Joachim Nilsson --- man/syslogd.8 | 7 ++++++- src/syslogd.c | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/man/syslogd.8 b/man/syslogd.8 index e1af553..ee49c82 100644 --- a/man/syslogd.8 +++ b/man/syslogd.8 @@ -13,7 +13,7 @@ .Nd System Log Daemon .Sh SYNOPSIS .Nm -.Op Fl ?46Adnsv +.Op Fl ?46AdnsTv .Op Fl a Ar addr[/len][:port] .Op Fl a Ar name[:port] .Op Fl b Ar addr[:port] @@ -233,6 +233,11 @@ is 5. Operate in secure mode. Do not log messages from remote machines. If specified twice, no network socket will be opened at all, which also disables logging to remote machines. +.It Fl T +Always use the local time and date for messages received from the +network, instead of the timestamp field supplied in the message by the +remote host. This is useful if some of the originating hosts cannot +keep time properly or are unable to generate a correct timestamp. .It Fl v Print .Nm diff --git a/src/syslogd.c b/src/syslogd.c index bf3ab52..906647c 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -233,6 +233,7 @@ int usage(int code) " -s Operate in secure mode, do not log messages from remote machines.\n" " If specified twice, no socket at all will be opened, which also\n" " disables support for logging to remote machines.\n" + " -T Use local time and date for all messages recived from remote hosts.\n" " -? Show this help text\n" " -v Show program version and exit\n" "\n" @@ -336,6 +337,10 @@ int main(int argc, char *argv[]) SecureMode++; break; + case 'T': + RemoteAddDate = 1; + break; + case 'v': printf("syslogd v%s\n", VERSION); exit(0);