Follow-up to 9856e07
, rename '-K' option to '-t'
We need the '-K' option to disable kernel logging, so this option needs to be renamed, unfortunately. Fortunately it's not been released yet. Issue #42 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
f38fd01871
commit
e61e5abb88
@ -38,7 +38,7 @@
|
|||||||
.Nd log systems messages
|
.Nd log systems messages
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl ?46AdFHKknsTv
|
.Op Fl ?46AdFHknsTtv
|
||||||
.Op Fl a Ar addr[/len][:port]
|
.Op Fl a Ar addr[/len][:port]
|
||||||
.Op Fl a Ar name[:port]
|
.Op Fl a Ar name[:port]
|
||||||
.Op Fl b Ar addr[:port]
|
.Op Fl b Ar addr[:port]
|
||||||
@ -255,24 +255,6 @@ and wants to monitor when and how it exits.
|
|||||||
.It Fl H
|
.It Fl H
|
||||||
When logging remote messages use hostname from the message (if supplied)
|
When logging remote messages use hostname from the message (if supplied)
|
||||||
instead of using address from which the message was received.
|
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
|
.It Fl k
|
||||||
Disable the translation of
|
Disable the translation of
|
||||||
messages received with facility
|
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.
|
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
|
This is useful if some of the originating hosts cannot keep time properly
|
||||||
or are unable to generate a correct timestamp.
|
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
|
.It Fl v
|
||||||
Show program version and exit.
|
Show program version and exit.
|
||||||
.El
|
.El
|
||||||
|
@ -286,7 +286,6 @@ int usage(int code)
|
|||||||
" -F Run in foreground, required when monitored by init(1)\n"
|
" -F Run in foreground, required when monitored by init(1)\n"
|
||||||
" -f FILE Alternate .conf file, default: %s\n"
|
" -f FILE Alternate .conf file, default: %s\n"
|
||||||
" -k Allow logging with facility 'kernel', otherwise remapped to 'user'\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"
|
" -m MINS Interval between MARK messages, 0 to disable, default: 20 min\n"
|
||||||
" -n Disable DNS query for every request\n"
|
" -n Disable DNS query for every request\n"
|
||||||
" -P FILE File to store the process ID, default: %s\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"
|
" -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"
|
" If specified twice, no socket at all will be opened, which also\n"
|
||||||
" disables support for logging to remote machines.\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"
|
" -T Use local time and date for messages received from remote hosts\n"
|
||||||
" -? Show this help text\n"
|
" -? Show this help text\n"
|
||||||
" -v Show program version and exit\n"
|
" -v Show program version and exit\n"
|
||||||
@ -318,7 +318,7 @@ int main(int argc, char *argv[])
|
|||||||
int pflag = 0, bflag = 0;
|
int pflag = 0, bflag = 0;
|
||||||
int ch;
|
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) {
|
switch ((char)ch) {
|
||||||
case '4':
|
case '4':
|
||||||
family = PF_INET;
|
family = PF_INET;
|
||||||
@ -373,10 +373,6 @@ int main(int argc, char *argv[])
|
|||||||
KeepKernFac = 1;
|
KeepKernFac = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K': /* keep/trust kernel timestamp always */
|
|
||||||
KeepKernTime = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'm': /* mark interval */
|
case 'm': /* mark interval */
|
||||||
MarkInterval = atoi(optarg) * 60;
|
MarkInterval = atoi(optarg) * 60;
|
||||||
break;
|
break;
|
||||||
@ -414,6 +410,10 @@ int main(int argc, char *argv[])
|
|||||||
RemoteAddDate = 1;
|
RemoteAddDate = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 't': /* keep/trust kernel timestamp always */
|
||||||
|
KeepKernTime = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("syslogd v%s\n", VERSION);
|
printf("syslogd v%s\n", VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -584,8 +584,15 @@ static void kernel_cb(int fd, void *arg)
|
|||||||
|
|
||||||
static int opensys(const char *file)
|
static int opensys(const char *file)
|
||||||
{
|
{
|
||||||
|
// struct stat st;
|
||||||
int fd;
|
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);
|
fd = open(file, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user