From cebec1202b23f903b38f2e165a5bca2a9aa9ee73 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 3 Nov 2019 12:19:06 +0100 Subject: [PATCH] Update man pages with new per-rule options and fix old paths Signed-off-by: Joachim Nilsson --- TODO.org | 2 +- man/syslog.conf.5 | 31 +++++++++++----------- man/syslogd.8 | 66 +++++++++++++++++++++++------------------------ 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/TODO.org b/TODO.org index b008fe2..039fd65 100644 --- a/TODO.org +++ b/TODO.org @@ -9,7 +9,7 @@ ** DONE Test support of =/etc/syslog.d/*.conf= to syslogd ** Test SIGHUP of syslogd ** DONE Custom facilities! -** Fix option parsing in syslog.conf, e.g. ;RFC5424 and log rotation +** DONE Fix option parsing in syslog.conf, e.g. ;RFC5424 and log rotation ** Test with/without openlog() ** Test custom facilities ** Test setlogmask() diff --git a/man/syslog.conf.5 b/man/syslog.conf.5 index f57d83f..90fe004 100644 --- a/man/syslog.conf.5 +++ b/man/syslog.conf.5 @@ -305,12 +305,12 @@ five files in total are kept, including the non-rotated file. This stores all messages of priority .Ql crit in the file -.Pa /var/adm/critical , +.Pa /var/log/critical , with the exception of any kernel messages. .Bd -literal -offset indent # Store critical stuff in critical # -*.=crit;kern.none /var/adm/critical +*.=crit;kern.none /var/log/critical .Ed .Ss Kernel This is an example of the 2nd selector overwriting part of the first @@ -325,19 +325,18 @@ and .Ql warning to get logged. .Bd -literal -offset indent -# Kernel messages are stored in the kernel file, -# critical messages and higher ones also go -# to another host and to the console +# Kernel messages are stored in the kernel file, critical messages and +# higher ones also go to another host and to the console # -kern.* /var/adm/kernel -kern.crit @finlandia;RFC5424 +kern.* /var/log/kernel +kern.crit @finlandia ;RFC5424 kern.crit /dev/console -kern.info;kern.!err /var/adm/kernel-info +kern.info;kern.!err /var/log/kernel.info .Ed .Pp The first rule directs any message that has the kernel facility to the file -.Pa /var/adm/kernel . +.Pa /var/log/kernel . Recall that only the kernel itself can log to this facility. .Pp The second statement directs all kernel messages of priority @@ -361,7 +360,7 @@ to save all kernel messages that come with priorities from up to .Ql warning in the file -.Pa /var/adm/kernel-info . +.Pa /var/log/kernel.info . .Ss Redirecting to a TTY This directs all messages that use .Ql mail.info @@ -384,11 +383,11 @@ This pattern matches all messages that come with the facility, except for the .Ql info priority. These will be stored in the file -.Pa /var/adm/mail . +.Pa /var/log/mail . .Bd -literal -offset indent # Write all mail related logs to a file # -mail.*;mail.!=info /var/adm/mail +mail.*;mail.!=info /var/log/mail .Ed .Ss Single Priority from Two Facilities This will extract all messages that come either with @@ -396,11 +395,11 @@ This will extract all messages that come either with or with .Ql news.info and store them in the file -.Pa /var/adm/info . +.Pa /var/log/info . .Bd -literal -offset indent # Log all mail.info and news.info messages to info # -mail,news.=info /var/adm/info +mail,news.=info /var/log/info .Ed .Ss Advanced Filtering, part 1 This logs all messages that come with either the @@ -456,8 +455,8 @@ and 'joey', if they're logged in. *.alert root,joey .Ed .Ss Log Rotation -This logs all messages except kernel messages to the file -.Pa /log/messages +This example logs all messages except kernel messages to the file +.Pa /var/log/messages without syncing ('-') the file after each log message. When the file reaches 100 kiB it is rotated. In total are only 10 rotated files, including the main file itself and compressed files kept. The size diff --git a/man/syslogd.8 b/man/syslogd.8 index bfc4bb2..1dfd77d 100644 --- a/man/syslogd.8 +++ b/man/syslogd.8 @@ -193,22 +193,28 @@ version and exit. .Sh CONFIGURATION FILE SYNTAX DIFFERENCES .Nm uses a slightly different syntax for its configuration file than the -original BSD sources. Originally all messages of a specific priority -and above were forwarded to the log file. +original BSD sources. First, rules may now also have a third field +.Cm ;OPTION . +Several options are supported, comma separated, that control formatting +and log rotation, for more on this see +.Xr syslog.conf 5 . +Second, originally all messages of a specific priority and above were +forwarded to the log file. .Pp -For example the following line caused ALL output from daemons using -the daemon facilities (debug is the lowest priority, so every higher -will also match) to go into -.Pa /usr/adm/daemons : +For example the following line send all output from daemons using the +daemon facilities (debug is the lowest priority, so every higher will +also match) to go into +.Pa /var/log/daemons : .Bd -literal -offset indent # Sample syslog.conf -daemon.debug /usr/adm/daemons +daemon.debug /var/log/daemons .Ed .Pp -Under the new scheme this behavior remains the same. The difference is -the addition of four new specifiers, the asterisk ('*') wildcard, the -equation sign ('='), the exclamation mark ('!'), and the minus sign -('-'). +With +.Nm +this behavior remains the same. The difference is the addition of four +additional specifiers, the asterisk ('*') wildcard, the equation sign +('='), the exclamation mark ('!'), and the minus sign ('-'). .Pp The '*' specifies that all messages for the specified facility are to be directed to the destination. Note that this behavior is degenerate with @@ -220,13 +226,14 @@ class. This allows, for example, routing only debug messages to a particular logging source. .Pp For example, the following line in -.Pa syslog.conf +.Pa /etc/syslog.conf directs debug messages from all sources to the -.Pa /usr/adm/debug -file. +.Pa /var/log/debug +file in RFC5424 format, with log rotation every 512 kiB, saving only 20 +files in total (including the non-rotated file): .Bd -literal -offset indent # Sample syslog.conf -*.=debug /usr/adm/debug +*.=debug -/var/log/debug ;RFC5424,rotate=512k:20 .Ed .Pp .\" The '!' as the first character of a priority inverts the above @@ -241,22 +248,24 @@ log all messages of facility except those with priority .Ql info to the -.Pa /usr/adm/mail +.Pa /var/log/mail file. All messages from .Ql news.info (including) to .Ql news.crit (excluding) are logged to the -.Pa /usr/adm/news +.Pa /var/log/news file. .Bd -literal -offset indent # Sample syslog.conf -mail.*;mail.!=info /usr/adm/mail -news.info;news.!crit /usr/adm/news +mail.*;mail.!=info /var/log/mail +news.info;news.!crit /var/log/news .Ed .Pp You may use it intuitively as an exception specifier. The above -mentioned interpretation is simply inverted. Doing that you may use +mentioned interpretation is simply inverted. For example, to skip +every message with facility +.Ar mail : .Bd -literal -offset indent mail.none .Ed @@ -269,19 +278,8 @@ or mail.!debug .Ed .Pp -to skip every message that comes with a mail facility. There is much -room to play with it. :-) -.Pp The '-' may only be used to prefix a filename if you want to omit sync'ing the file after every write to it. -.Pp -This may take some acclimatization for those individuals used to the -pure BSD behavior but testers have indicated that this syntax is -somewhat more flexible than the BSD behavior. Note that these changes -do not affect standard -.Xr syslog.conf 5 -files. You must specifically modify the configuration files to obtain -the new features. .Sh REMOTE LOGGING The following modifications provide network support to the .Nm @@ -335,7 +333,7 @@ entry: .Bd -literal -offset indent # Sample syslogd configuration file to forward all message # messages to a remote host using RFC5424 style formatting -*.* @hostname;RFC5424 +*.* @hostname;RFC5424 .Ed .Pp To forward all @@ -400,9 +398,9 @@ The following configuration file routes debug messages from the kernel to a FIFO: .Bd -literal -offset indent # Sample configuration to route kernel debugging -# messages ONLY to /usr/adm/debug which is a +# messages ONLY to /var/log/debug which is a # named pipe. -kern.=debug |/usr/adm/debug +kern.=debug |/var/log/debug .Ed .Sh CONCERNS There is probably one important consideration when installing this