diff --git a/man/syslogd.8 b/man/syslogd.8 index 78517cd..17479e3 100644 --- a/man/syslogd.8 +++ b/man/syslogd.8 @@ -38,7 +38,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl ?46AdFHKknsTv +.Op Fl ?46AdFHknsTtv .Op Fl a Ar addr[/len][:port] .Op Fl a Ar name[:port] .Op Fl b Ar addr[:port] @@ -255,24 +255,6 @@ and wants to monitor when and how it exits. .It Fl H When logging remote messages use hostname from the message (if supplied) instead of using address from which the message was received. -.It Fl K -Keep (trust) kernel timestamp. -.Pp -On Linux systems the -.Pa /dev/kmsg -timestamp is a monotonic clock, in microseconds, relative to the boot of -the system. This timestamp is, among other things, -.Sy not -adjusted for suspend/resume cycles, meaning the kernel logs can start to -go out of sync with the rest of the system. This in turn can make it -really hard to correlate events. -.Pp -.Nm -by default only trusts the kernel timestamp when starting up the first -time. As soon as the the kernel ring buffer has been emptied, -.Nm -uses its own current time for each received kernel log message. This -option disables that behavior. .It Fl k Disable the translation of messages received with facility @@ -336,6 +318,24 @@ 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 t +Keep (trust) kernel timestamp. +.Pp +On Linux systems the +.Pa /dev/kmsg +timestamp is a monotonic clock, in microseconds, relative to the boot of +the system. This timestamp is, among other things, +.Sy not +adjusted for suspend/resume cycles, meaning the kernel logs can start to +go out of sync with the rest of the system. This in turn can make it +really hard to correlate events. +.Pp +.Nm +by default only trusts the kernel timestamp when starting up the first +time. As soon as the the kernel ring buffer has been emptied, +.Nm +uses its own current time for each received kernel log message. This +option disables that behavior. .It Fl v Show program version and exit. .El diff --git a/src/syslogd.c b/src/syslogd.c index fa4303f..227b956 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -286,7 +286,6 @@ int usage(int code) " -F Run in foreground, required when monitored by init(1)\n" " -f FILE Alternate .conf file, default: %s\n" " -k Allow logging with facility 'kernel', otherwise remapped to 'user'\n" - " -K Keep kernel timestamp, even after initial ring buffer emptying\n" " -m MINS Interval between MARK messages, 0 to disable, default: 20 min\n" " -n Disable DNS query for every request\n" " -P FILE File to store the process ID, default: %s\n" @@ -298,6 +297,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 Keep kernel timestamp, even after initial ring buffer emptying\n" " -T Use local time and date for messages received from remote hosts\n" " -? Show this help text\n" " -v Show program version and exit\n" @@ -318,7 +318,7 @@ int main(int argc, char *argv[]) int pflag = 0, bflag = 0; int ch; - while ((ch = getopt(argc, argv, "46Aa:b:C:dHFf:Kkm:nP:p:r:sTv?")) != EOF) { + while ((ch = getopt(argc, argv, "46Aa:b:C:dHFf:km:nP:p:r:sTtv?")) != EOF) { switch ((char)ch) { case '4': family = PF_INET; @@ -373,10 +373,6 @@ int main(int argc, char *argv[]) KeepKernFac = 1; break; - case 'K': /* keep/trust kernel timestamp always */ - KeepKernTime = 1; - break; - case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; @@ -414,6 +410,10 @@ int main(int argc, char *argv[]) RemoteAddDate = 1; break; + case 't': /* keep/trust kernel timestamp always */ + KeepKernTime = 1; + break; + case 'v': printf("syslogd v%s\n", VERSION); exit(0); @@ -584,8 +584,15 @@ static void kernel_cb(int fd, void *arg) static int opensys(const char *file) { +// struct stat st; int fd; +// sleep(300); +// return 1; + +// if (stat(file, &st) || !S_ISCHR(st.st_mode)) +// return 1; + fd = open(file, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0); if (fd < 0) return 1;