Re: svn commit: r332100 - in head: . lib/libc/gen sys/sys
On Friday, April 6, 2018, Ed Schouten wrote: > Author: ed > Date: Fri Apr 6 13:00:45 2018 > New Revision: 332100 > URL: https://svnweb.freebsd.org/changeset/base/332100 > > Log: > Let syslog(3) use RFC 5424. > > With r332099 changing syslogd(8) to parse RFC 5424 formatted syslog > messages, go ahead and also change the syslog(3) libc function to > generate them. Compared to RFC 3164, RFC 5424 has various advantages, > such as sub-second precision for log entry timestamps. > > As this change could have adverse effects when not updating syslogd(8) > or using a different system logging daemon, add a notice to UPDATING and > increase __FreeBSD_version. > > Differential Revision:https://reviews.freebsd.org/D14926 += relnotes = yes > > Modified: > head/UPDATING > head/lib/libc/gen/syslog.3 > head/lib/libc/gen/syslog.c > head/sys/sys/param.h > > Modified: head/UPDATING > > == > --- head/UPDATING Fri Apr 6 12:57:01 2018(r332099) > +++ head/UPDATING Fri Apr 6 13:00:45 2018(r332100) > @@ -51,6 +51,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: > > ** SPECIAL WARNING: > ** > > +20180406: > + In addition to supporting RFC 3164 formatted messages, the > + syslogd(8) service is now capable of parsing RFC 5424 formatted > + log messages. The main benefit of using RFC 5424 is that clients > + may now send log messages with timestamps containing year numbers, > + microseconds and time zone offsets. > + > + Similarly, the syslog(3) C library function has been altered to > + send RFC 5424 formatted messages to the local system logging > + daemon. On systems using syslogd(8), this change should have no > + negative impact, as long as syslogd(8) and the C library are > + updated at the same time. On systems using a different system > + logging daemon, it may be necessary to make configuration > + adjustments, depending on the software used. > + > + When using syslog-ng, add the 'syslog-protocol' flag to local > + input sources to enable parsing of RFC 5424 formatted messages: > + > + source src { > + unix-dgram("/var/run/log" flags(syslog-protocol)); > + } > + > + When using rsyslog, disable the 'SysSock.UseSpecialParser' option > + of the 'imuxsock' module to let messages be processed by the > + regular RFC 3164/5424 parsing pipeline: > + > + module(load="imuxsock" SysSock.UseSpecialParser="off") > + > + Do note that these changes only affect communication between local > + applications and syslogd(8). The format that syslogd(8) uses to > + store messages on disk or forward messages to other systems > + remains unchanged. syslogd(8) still uses RFC 3164 for these > + purposes. Options to customize this behaviour will be added in the > + future. Utilities that process log files stored in /var/log are > + thus expected to continue to function as before. > + > + __FreeBSD_version has been incremented to 1200061 to denote this > + change. > + > 20180328: > Support for token ring networks has been removed. If you > have "device token" in your kernel config you should remove > > Modified: head/lib/libc/gen/syslog.3 > > == > --- head/lib/libc/gen/syslog.3 Fri Apr 6 12:57:01 2018(r332099) > +++ head/lib/libc/gen/syslog.3 Fri Apr 6 13:00:45 2018(r332100) > @@ -28,7 +28,7 @@ > .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 > .\" $FreeBSD$ > .\" > -.Dd November 5, 2017 > +.Dd April 6, 2018 > .Dt SYSLOG 3 > .Os > .Sh NAME > @@ -156,6 +156,9 @@ Write the message to standard error output as well to > .It Dv LOG_PID > Log the process id with each message: useful for identifying > instantiations of daemons. > +On > +.Fx , > +this option is enabled by default. > .El > .Pp > The > > Modified: head/lib/libc/gen/syslog.c > > == > --- head/lib/libc/gen/syslog.c Fri Apr 6 12:57:01 2018(r332099) > +++ head/lib/libc/gen/syslog.c Fri Apr 6 13:00:45 2018(r332100) > @@ -36,9 +36,10 @@ static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/ > __FBSDID("$FreeBSD$"); > > #include "namespace.h" > -#include > +#include > #include > #include > +#include > #include > #include > #include > @@ -134,11 +135,13 @@ syslog(int pri, const char *fmt, ...) > static void > vsyslog1(int pri, const char *fmt, va_list ap) > { > - int cnt; > + struct timeval now; > + struct tm tm; > char ch, *p; > - time_t now; > - int fd, saved_errno; > - char *stdp, tbuf[2048],
Re: svn commit: r332100 - in head: . lib/libc/gen sys/sys
On 4/6/18 6:00 AM, Ed Schouten wrote: > Author: ed > Date: Fri Apr 6 13:00:45 2018 > New Revision: 332100 > URL: https://svnweb.freebsd.org/changeset/base/332100 > > Log: > Let syslog(3) use RFC 5424. > > With r332099 changing syslogd(8) to parse RFC 5424 formatted syslog > messages, go ahead and also change the syslog(3) libc function to > generate them. Compared to RFC 3164, RFC 5424 has various advantages, > such as sub-second precision for log entry timestamps. > > As this change could have adverse effects when not updating syslogd(8) > or using a different system logging daemon, add a notice to UPDATING and > increase __FreeBSD_version. > > Differential Revision: https://reviews.freebsd.org/D14926 It looks like this changes the format in which messages are written to stderr via the LOG_PERROR flag; this is visible if you run # echo foo | logger -s which used to print "root: foo" but now prints "root 40038 - - foo". Was this intentional? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332100 - in head: . lib/libc/gen sys/sys
Author: ed Date: Fri Apr 6 13:00:45 2018 New Revision: 332100 URL: https://svnweb.freebsd.org/changeset/base/332100 Log: Let syslog(3) use RFC 5424. With r332099 changing syslogd(8) to parse RFC 5424 formatted syslog messages, go ahead and also change the syslog(3) libc function to generate them. Compared to RFC 3164, RFC 5424 has various advantages, such as sub-second precision for log entry timestamps. As this change could have adverse effects when not updating syslogd(8) or using a different system logging daemon, add a notice to UPDATING and increase __FreeBSD_version. Differential Revision:https://reviews.freebsd.org/D14926 Modified: head/UPDATING head/lib/libc/gen/syslog.3 head/lib/libc/gen/syslog.c head/sys/sys/param.h Modified: head/UPDATING == --- head/UPDATING Fri Apr 6 12:57:01 2018(r332099) +++ head/UPDATING Fri Apr 6 13:00:45 2018(r332100) @@ -51,6 +51,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ** SPECIAL WARNING: ** +20180406: + In addition to supporting RFC 3164 formatted messages, the + syslogd(8) service is now capable of parsing RFC 5424 formatted + log messages. The main benefit of using RFC 5424 is that clients + may now send log messages with timestamps containing year numbers, + microseconds and time zone offsets. + + Similarly, the syslog(3) C library function has been altered to + send RFC 5424 formatted messages to the local system logging + daemon. On systems using syslogd(8), this change should have no + negative impact, as long as syslogd(8) and the C library are + updated at the same time. On systems using a different system + logging daemon, it may be necessary to make configuration + adjustments, depending on the software used. + + When using syslog-ng, add the 'syslog-protocol' flag to local + input sources to enable parsing of RFC 5424 formatted messages: + + source src { + unix-dgram("/var/run/log" flags(syslog-protocol)); + } + + When using rsyslog, disable the 'SysSock.UseSpecialParser' option + of the 'imuxsock' module to let messages be processed by the + regular RFC 3164/5424 parsing pipeline: + + module(load="imuxsock" SysSock.UseSpecialParser="off") + + Do note that these changes only affect communication between local + applications and syslogd(8). The format that syslogd(8) uses to + store messages on disk or forward messages to other systems + remains unchanged. syslogd(8) still uses RFC 3164 for these + purposes. Options to customize this behaviour will be added in the + future. Utilities that process log files stored in /var/log are + thus expected to continue to function as before. + + __FreeBSD_version has been incremented to 1200061 to denote this + change. + 20180328: Support for token ring networks has been removed. If you have "device token" in your kernel config you should remove Modified: head/lib/libc/gen/syslog.3 == --- head/lib/libc/gen/syslog.3 Fri Apr 6 12:57:01 2018(r332099) +++ head/lib/libc/gen/syslog.3 Fri Apr 6 13:00:45 2018(r332100) @@ -28,7 +28,7 @@ .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 5, 2017 +.Dd April 6, 2018 .Dt SYSLOG 3 .Os .Sh NAME @@ -156,6 +156,9 @@ Write the message to standard error output as well to .It Dv LOG_PID Log the process id with each message: useful for identifying instantiations of daemons. +On +.Fx , +this option is enabled by default. .El .Pp The Modified: head/lib/libc/gen/syslog.c == --- head/lib/libc/gen/syslog.c Fri Apr 6 12:57:01 2018(r332099) +++ head/lib/libc/gen/syslog.c Fri Apr 6 13:00:45 2018(r332100) @@ -36,9 +36,10 @@ static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/ __FBSDID("$FreeBSD$"); #include "namespace.h" -#include +#include #include #include +#include #include #include #include @@ -134,11 +135,13 @@ syslog(int pri, const char *fmt, ...) static void vsyslog1(int pri, const char *fmt, va_list ap) { - int cnt; + struct timeval now; + struct tm tm; char ch, *p; - time_t now; - int fd, saved_errno; - char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26], errstr[64]; + long tz_offset; + int cnt, fd, saved_errno; + char hostname[MAXHOSTNAMELEN], *stdp, tbuf[2048], fmt_cpy[1024], + errstr[64], tz_sign; FILE *fp, *fmt_fp; struct bufcookie tbuf_cookie; struct bufcookie fmt_cookie; @@ -168,24