]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add RFC 5424 syslog message parsing to syslogd.
authored <ed@FreeBSD.org>
Fri, 6 Apr 2018 12:57:01 +0000 (12:57 +0000)
committered <ed@FreeBSD.org>
Fri, 6 Apr 2018 12:57:01 +0000 (12:57 +0000)
commit63016881446b786997c4e583e4b52983d52198b5
tree2fece8ea0779eed61564ef0b86fc380de82cc5fd
parente1f89be1d34851060bb5506859aa1ef3899337a2
Add RFC 5424 syslog message parsing to syslogd.

Syslogd currently uses the RFC 3164 format for its log messages.One
limitation of RFC 3164 is that it cannot be used to log entries with
sub-second precision timestamps. One of our users has expressed a desire
for doing this for doing some basic performance measurements.

This change attempts to make a first cut at switching to RFC 5424 based
logging. The first step is to alter syslogd's input path to properly
parse such messages. It alters the logmsg() prototype to match the
fields of RFC 5424. The parsemsg() function is extended to parse both
RFC 3164 and 5424 messages and call into logmsg() accordingly.

Additional changes include:

- Introducing proper parsing of timestamps, so that they can be printed
  in any desired output format. This means we need to infer the year and
  timezone for RFC 3164 timestamps.
- Removing ISKERNEL. This can now be realised by simply providing an
  APP-NAME (== "kernel").
- Extending RFC 3164 parsing to trim off the TAG prefix and using that
  to derive APP-NAME and PROCID.
- Increase MAXLINE. RFC 5424 mentions we should support 2k messages.

Differential Revision: https://reviews.freebsd.org/D14926
usr.sbin/syslogd/syslogd.c