Thanks for looking into this.

On Sat, 2022-01-22 at 10:05 -0700, Theo de Raadt wrote:
> > Note that this only adds the parsing, the rest of the current behaviour
> > of stays the same. I have another diff in the pipeline for allowing the
> > hostname in the message.
> 
> I object to this process.
> 
> You want to add parsing code as a fait accompli. With no justification.
> Then later on, spring on us the code that uses it.

Sorry if my phrasing was off, but I do think the diff stands on its own
and I thought I made that case in the first paragraph. Even though I
include the mentioned follow up diffs below, let me try to rephrase my
case for it as a stand alone diff.

Right now we have 3 elements where syslog.conf can filter on: priority,
hostname, and progname. hostname currently always comes from the input
source:
- sendsyslog(2), /dev/klog, unix socket, vlogmsg(), and markit() use
  LocalHostName
- UDP/TCP/TLS print reverse lookup or numerical if -n is specified

My previous parsemsg() diff didn't change any behaviour, but makes it
more clear what's going on. When a message is handled through
printline() it goes through parsemsg(). Here we first check for an
optional priority and timestamp. parsemsg_priority() is the original
priority parsing code and parsemsg_timestamp_{bsd,v1} are the original
code lifted from logmsg. After that we continue to parsemsg_prog, which
is also lifted from logmsg(). In other words, at no point do we look
for a hostname in a message.
So if someone were to set -h in syslogd or use any other syslog server
that includes a hostname in the message and would relay it to a
syslogd(8) it would first parse priority/timestamp (if available) and
then continue to interpret the "first word" as progname. So a message
like: "<13>Jan 25 20:35:44 myhost myprog: mymsg" send over localhost
would have myhost as progname and localhost (or 127.0.0.1 if -n is
used) as hostname. So if someone would have "!myprog" in their
syslog.conf it would not match (while it should) and someone who
would have "!myhost" in their syslog.conf would match, while it
shouldn't.

What my diff does is based mainly on syslog(3) (and happens to match
what I've mostly seen in the wild) by saying that a progname should end
in a ':' or a '['. This is also what NetBSD does. By this minor change
we can reliably determine what the progname is and by that merit
determine what the hostname is.

The hostname in the original diff is stored in struct msg and not looked
at again, effectively replacing the hostname with the address found by
the input source. This behaviour should be identical to FreeBSD, which
has the -H flag to preserve the hostname in the message. To make this
explicit, the example message previously would be written out as:
"<13>Jan 25 20:35:44 localhost myprog: mymsg" instead of the current
"<13>Jan 25 20:35:44 localhost myhost myprog: mymsg"
and "+localhost" would continue to keep working as always.

>   What if we disagree
> with the code that uses it?  Will you delete this parsing code which
> nothing uses?

Fixing the "!progname" case should be sufficient reason on its own and
no other.
> 
> > - Timestamp: is easy to interpret, since it's a strict format.
> >   No changes here.
> 
> I believe "timestamp missing" is not strictly permitted.  But this was
> common for a while, and in OpenBSD it is the default message format.
> This is a due to the desire to make syslog_r(3) be signal/re-entrant
> safe on top of sendsyslog(2).  Then there is no good way of creating a
> timestamp string in the sender libc context.  A timestamp is easily
> re-inserted by the receiving syslogd.
> 
> > +       for (i = 0; i < HOST_NAME_MAX; i++) {
> 
> Unlike MAXHOSTNAMELEN/NI_MAXHOST, HOST_NAME_MAX storage does not include
> a NUL.  You might have the loop right.  Be careful.

I've defined it as "char m_hostname[HOST_NAME_MAX + 1];", so we have room
for the NUL.
> 
> > +                * fqdn: [[:alnum:]-.]
> 
> That is not totally correct.
> 
> hostnames very often also contain '_' in the middle positions, early
> RFCs said no, but around 1990-ish Vixie in particular had to face
> reality..  I was involved in that conversation, it seems so long ago.
> 
> Your pattern is also incorrect in other ways, such as ".." is not legal,
> hostnames cannot start or end with '-' or '-', etc.  The current accepted
> rules are encoded in the undocumented libc function __res_hnok in
> lib/libc/net/res_comp.c

I wasn't aware of res_hnok. I see that it's used in other applications as
well. I changed it to use strcspn to look for the terminating space and
try inet_pton and res_hnok to check if it's valid. This makes the code a
lot cleaner. Thanks.
> 
> I don't know if false-identification of broken hostnames is bad or not
> I guess it depends what will happen with this information later on [ie.
> the part of your proposal that is being kept a secret].

The same thing that already happens. Writing it out to log-files and
using it to match on "+hostname" lines in syslog.conf.

As for keeping it a secret, that was not my intention. I just didn't felt
that they were ready to be shown to a wider audience. Probably shouldn't
have hinted at it, since the diff could stand perfectly well on its own.

Anyway. I've included the follow up diffs below to not keep any secrets.
Both are discussed conceptually with bluhm@.
1) -h gets neutered and we always include the hostname when sending out
   a message.
2) add -H. This is similar to FreeBSD in that we use the hostname found
   in the message (if any) instead of the one syslogd(8) detected.
> 
> Will an incorrect parse become dangerous, I don't know.  Because you
> are keeping a secret.

I don't think so, see reasoning above.
> 
> I also don't know happen when I use a program called foo.com, which will
> look like a hostname obviously.  There is absolutely zero strictness for
> messages programs can send -- any program can send ANY GARBAGE it wants
> -- so I'm confused as to the purpose of this proposed layer.  So I am
> confused why there is an attempt to messages indistinguishable from garbage.

if someone would have a program named foo.com and it's not closed of
with a ':' or '[' as syslog(3) would do, it would parse as a hostname.
However, as things stand interpretation can be broken with the base
tools. I can't fix garbage input.
> 
> I will also bring up log4j.  People thought the software only did logging.
> As in receive messages, and store or redirect them.  Similarily in syslogd,
> we expect this layer to do the ABSOLUTE MINUMUM, because this daemon code is
> always running a a critical position and we cannot accept it having a hole.

The goal here is not to add functionality, just more concise
parsing/handling of existing functionality.
> 
> syslogd was intentionally simple.  Why does syslogd now need to parse
> messages, when it hasn't parsed messages since instruction in 4.3BSD?
> But you didn't tell us your proposal, you kept it a secret.
> 
> You diff is not OK.
> 
With the question of putting the emphasis on parsemsg.[ch] and keeping
syslogd.[8c] mainly for context. Does this look better?

martijn@

Index: usr.sbin/syslogd/parsemsg.c
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/parsemsg.c,v
retrieving revision 1.1
diff -u -p -r1.1 parsemsg.c
--- usr.sbin/syslogd/parsemsg.c 13 Jan 2022 10:34:07 -0000      1.1
+++ usr.sbin/syslogd/parsemsg.c 25 Jan 2022 20:44:19 -0000
@@ -17,8 +17,14 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <sys/socket.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
 #include <ctype.h>
 #include <limits.h>
+#include <resolv.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -29,27 +35,42 @@
 
 size_t parsemsg_timestamp_bsd(const char *, char *);
 size_t parsemsg_timestamp_v1(const char *, char *);
+size_t parsemsg_hostname(const char *, char *);
 size_t parsemsg_prog(const char *, char *);
 
 struct msg *
 parsemsg(const char *msgstr, struct msg *msg)
 {
-       size_t n;
+       size_t timelen, proglen;
+       const char *hostname;
 
        msg->m_pri = -1;
        msgstr += parsemsg_priority(msgstr, &msg->m_pri);
        if (msg->m_pri &~ (LOG_FACMASK|LOG_PRIMASK))
                msg->m_pri = -1;
 
-       if ((n = parsemsg_timestamp_bsd(msgstr, msg->m_timestamp)) == 0)
-               n = parsemsg_timestamp_v1(msgstr, msg->m_timestamp);
-       msgstr += n;
+       if ((timelen = parsemsg_timestamp_bsd(msgstr, msg->m_timestamp)) == 0)
+               timelen = parsemsg_timestamp_v1(msgstr, msg->m_timestamp);
+       msgstr += timelen;
 
-       while (isspace(msgstr[0]))
+       while (isspace((unsigned char)msgstr[0]))
                msgstr++;
 
-       parsemsg_prog(msgstr, msg->m_prog);
+       hostname = msgstr;
+       msgstr += parsemsg_hostname(msgstr, msg->m_hostname);
+ 
+       while (isspace((unsigned char)msgstr[0]))
+               msgstr++;
 
+       proglen = parsemsg_prog(msgstr, msg->m_prog);
+
+       /*
+        * Without timestamp and tag, assume hostname as part of message.
+        */
+       if (!timelen && !proglen) {
+               msg->m_hostname[0] = '\0';
+               msgstr = hostname;
+       }
        strlcpy(msg->m_msg, msgstr, sizeof(msg->m_msg));
 
        return msg;
@@ -169,6 +190,47 @@ parsemsg_timestamp_v1(const char *msgstr
        return msg - msgstr;
 }
 
+/*
+ * Parse the ip address or hostname according to inet_pton and res_hnok and
+ * return the length of the hostname including the trailing space if available.
+ */
+size_t
+parsemsg_hostname(const char *msgstr, char *hostname)
+{
+       size_t len;
+       struct in_addr buf4;
+       struct in6_addr buf6;
+
+       if (msgstr[0] == '-' && (msgstr[1] == ' ' || msgstr[1] == '\0')) {
+               hostname[0] = '\0';
+               if (msgstr[1] == '\0')
+                       return 1;
+               return 2;
+       }
+
+       if ((len = strcspn(msgstr, " ")) > HOST_NAME_MAX)
+               return 0;
+       strlcpy(hostname, msgstr, len + 1);
+       if (msgstr[len] == ' ')
+               len++;
+
+       if (inet_pton(AF_INET, hostname, &buf4) == 1 ||
+           inet_pton(AF_INET6, hostname, &buf6) == 1) {
+               return len;
+       }
+
+       if (res_hnok(hostname) == 0) {
+               hostname[0] = '\0';
+               return 0;
+       }
+       return len;
+}
+
+/*
+ * Parse a program name of the form [[:alnum:]-._]{1,255}
+ * and which ends in [:[].
+ * It return the length of the tag up to the closing symbol.
+ */
 size_t
 parsemsg_prog(const char *msg, char *prog)
 {
@@ -179,6 +241,10 @@ parsemsg_prog(const char *msg, char *pro
                    msg[i] != '-' && msg[i] != '.' && msg[i] != '_')
                        break;
                prog[i] = msg[i];
+       }
+       if (msg[i] != ':' && msg[i] != '[') {
+               prog[0] = '\0';
+               return 0;
        }
        prog[i] = '\0';
 
Index: usr.sbin/syslogd/parsemsg.h
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/parsemsg.h,v
retrieving revision 1.1
diff -u -p -r1.1 parsemsg.h
--- usr.sbin/syslogd/parsemsg.h 13 Jan 2022 10:34:07 -0000      1.1
+++ usr.sbin/syslogd/parsemsg.h 25 Jan 2022 20:44:19 -0000
@@ -25,6 +25,7 @@
 struct msg {
        int             m_pri;
        char            m_timestamp[33];
+       char            m_hostname[HOST_NAME_MAX + 1];
        char            m_prog[NAME_MAX + 1];
        char            m_msg[LOG_MAXLINE + 1];
 };
Index: usr.sbin/syslogd/syslogd.8
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/syslogd.8,v
retrieving revision 1.60
diff -u -p -r1.60 syslogd.8
--- usr.sbin/syslogd/syslogd.8  27 Sep 2018 08:33:25 -0000      1.60
+++ usr.sbin/syslogd/syslogd.8  25 Jan 2022 20:44:19 -0000
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .Nm syslogd
 .Bk -words
-.Op Fl 46dFhnruVZ
+.Op Fl 46dFHnruVZ
 .Op Fl a Ar path
 .Op Fl C Ar CAfile
 .Op Fl c Ar cert_file
@@ -102,8 +102,10 @@ terminal and running as a background dae
 Specify the pathname of an alternate configuration file;
 the default is
 .Pa /etc/syslog.conf .
-.It Fl h
-Include the hostname when sending messages to a remote loghost.
+.It Fl H
+Use the hostname from the received message
+.Pq if detected
+instead of the address from which the message was received.
 .It Fl K Ar CAfile
 PEM encoded file containing CA certificates used for client certificate
 validation on the local listen socket.
Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.273
diff -u -p -r1.273 syslogd.c
--- usr.sbin/syslogd/syslogd.c  13 Jan 2022 10:34:07 -0000      1.273
+++ usr.sbin/syslogd/syslogd.c  25 Jan 2022 20:44:20 -0000
@@ -228,7 +228,7 @@ int Repeat = 0;             /* 0 msg repeated, 1 in
 int    SecureMode = 1;         /* when true, speak only unix domain socks */
 int    NoDNS = 0;              /* when true, refrain from doing DNS lookups */
 int    ZuluTime = 0;           /* display date and time in UTC ISO format */
-int    IncludeHostname = 0;    /* include RFC 3164 hostnames when forwarding */
+int    AllowHostname = 0;      /* use hostname found in message */
 int    Family = PF_UNSPEC;     /* protocol family, may disable IPv4 or IPv6 */
 
 struct tls *server_ctx;
@@ -338,7 +338,7 @@ void        fprintlog(struct filed *, int, char
 void   dropped_warn(int *, const char *);
 void   init(void);
 void   logevent(int, const char *);
-void   logmsg(struct msg *, int, char *);
+void   logmsg(struct msg *, int);
 struct filed *find_dup(struct filed *);
 void   printline(char *, char *);
 void   printsys(char *);
@@ -392,7 +392,7 @@ main(int argc, char *argv[])
        nbind = nlisten = ntls = 0;
 
        while ((ch = getopt(argc, argv,
-           "46a:C:c:dFf:hK:k:m:nP:p:rS:s:T:U:uVZ")) != -1) {
+           "46a:C:c:dFf:HhK:k:m:nP:p:rS:s:T:U:uVZ")) != -1) {
                switch (ch) {
                case '4':               /* disable IPv6 */
                        Family = PF_INET;
@@ -421,8 +421,10 @@ main(int argc, char *argv[])
                case 'f':               /* configuration file */
                        ConfFile = optarg;
                        break;
-               case 'h':               /* RFC 3164 hostnames */
-                       IncludeHostname = 1;
+               case 'H':               /* Allow hostname from message */
+                       AllowHostname = 1;
+                       break;
+               case 'h':               /* backwards compat */
                        break;
                case 'K':               /* verify client with CA file */
                        ServerCAfile = optarg;
@@ -1548,7 +1550,7 @@ usage(void)
 {
 
        (void)fprintf(stderr,
-           "usage: syslogd [-46dFhnruVZ] [-a path] [-C CAfile]\n"
+           "usage: syslogd [-46dFHnruVZ] [-a path] [-C CAfile]\n"
            "\t[-c cert_file] [-f config_file] [-K CAfile] [-k key_file]\n"
            "\t[-m mark_interval] [-p log_socket] [-S listen_address]\n"
            "\t[-s reporting_socket] [-T listen_address] [-U bind_address]\n");
@@ -1588,8 +1590,10 @@ printline(char *hname, char *msgstr)
 
        if (msg.m_timestamp[0] == '\0')
                current_time(msg.m_timestamp);
+       if (msg.m_hostname[0] == '\0' || !AllowHostname)
+               strlcpy(msg.m_hostname, hname, sizeof(msg.m_hostname));
 
-       logmsg(&msg, 0, hname);
+       logmsg(&msg, 0);
 }
 
 /*
@@ -1605,6 +1609,7 @@ printsys(char *msgstr)
        int l;
 
        current_time(msg.m_timestamp);
+       strlcpy(msg.m_hostname, LocalHostName, sizeof(msg.m_hostname));
        strlcpy(msg.m_prog, _PATH_UNIX, sizeof(msg.m_prog));
        l = snprintf(msg.m_msg, sizeof(msg.m_msg), "%s: ", _PATH_UNIX);
        if (l < 0 || l >= sizeof(msg.m_msg)) {
@@ -1629,7 +1634,7 @@ printsys(char *msgstr)
                    q < &msg.m_msg[sizeof(msg.m_msg) - 4])
                        q = vis(q, c, 0, 0);
 
-               logmsg(&msg, flags, LocalHostName);
+               logmsg(&msg, flags);
        }
 }
 
@@ -1641,6 +1646,7 @@ vlogmsg(int pri, const char *prog, const
 
        msg.m_pri = pri;
        current_time(msg.m_timestamp);
+       strlcpy(msg.m_hostname, LocalHostName, sizeof(msg.m_hostname));
        strlcpy(msg.m_prog, prog, sizeof(msg.m_prog));
        l = snprintf(msg.m_msg, sizeof(msg.m_msg), "%s[%d]: ", prog, getpid());
        if (l < 0 || l >= sizeof(msg.m_msg))
@@ -1654,7 +1660,7 @@ vlogmsg(int pri, const char *prog, const
                init_dropped++;
                return;
        }
-       logmsg(&msg, 0, LocalHostName);
+       logmsg(&msg, 0);
 }
 
 struct timeval now;
@@ -1684,14 +1690,14 @@ current_time(char *timestamp)
  * the priority.
  */
 void
-logmsg(struct msg *msg, int flags, char *from)
+logmsg(struct msg *msg, int flags)
 {
        struct filed *f;
        int fac, msglen, prilev;
 
        (void)gettimeofday(&now, NULL);
        log_debug("logmsg: pri 0%o, flags 0x%x, from %s, prog %s, msg %s",
-           msg->m_pri, flags, from, msg->m_prog, msg->m_msg);
+           msg->m_pri, flags, msg->m_hostname, msg->m_prog, msg->m_msg);
 
        /* extract facility and priority level */
        if (flags & MARK)
@@ -1706,7 +1712,7 @@ logmsg(struct msg *msg, int flags, char 
                if (f->f_type == F_CONSOLE) {
                        strlcpy(f->f_lasttime, msg->m_timestamp,
                            sizeof(f->f_lasttime));
-                       strlcpy(f->f_prevhost, from,
+                       strlcpy(f->f_prevhost, msg->m_hostname,
                            sizeof(f->f_prevhost));
                        fprintlog(f, flags, msg->m_msg);
                        /* May be set to F_UNUSED, try again next time. */
@@ -1726,7 +1732,8 @@ logmsg(struct msg *msg, int flags, char 
                /* skip messages with the incorrect program or hostname */
                if (f->f_program && fnmatch(f->f_program, msg->m_prog, 0) != 0)
                        continue;
-               if (f->f_hostname && fnmatch(f->f_hostname, from, 0) != 0)
+               if (f->f_hostname && fnmatch(f->f_hostname,
+                   msg->m_hostname, 0) != 0)
                        continue;
 
                if (f->f_type == F_CONSOLE && (flags & IGN_CONS))
@@ -1745,7 +1752,7 @@ logmsg(struct msg *msg, int flags, char 
                    f->f_type != F_FORWTCP && f->f_type != F_FORWTLS))) &&
                    (flags & MARK) == 0 && msglen == f->f_prevlen &&
                    !strcmp(msg->m_msg, f->f_prevline) &&
-                   !strcmp(from, f->f_prevhost)) {
+                   !strcmp(msg->m_hostname, f->f_prevhost)) {
                        strlcpy(f->f_lasttime, msg->m_timestamp,
                            sizeof(f->f_lasttime));
                        f->f_prevcount++;
@@ -1770,7 +1777,7 @@ logmsg(struct msg *msg, int flags, char 
                        f->f_prevpri = msg->m_pri;
                        strlcpy(f->f_lasttime, msg->m_timestamp,
                            sizeof(f->f_lasttime));
-                       strlcpy(f->f_prevhost, from,
+                       strlcpy(f->f_prevhost, msg->m_hostname,
                            sizeof(f->f_prevhost));
                        if (msglen < MAXSVLINE) {
                                f->f_prevlen = msglen;
@@ -1846,40 +1853,18 @@ fprintlog(struct filed *f, int flags, ch
        }
        v++;
 
-       switch (f->f_type) {
-       case F_FORWUDP:
-       case F_FORWTCP:
-       case F_FORWTLS:
-               if (IncludeHostname) {
-                       v->iov_base = LocalHostName;
-                       v->iov_len = strlen(LocalHostName);
-                       v++;
-                       v->iov_base = " ";
-                       v->iov_len = 1;
-               } else {
-                       /* XXX RFC requires to include host name */
-                       v->iov_base = "";
-                       v->iov_len = 0;
-                       v++;
-                       v->iov_base = "";
-                       v->iov_len = 0;
-               }
-               break;
-       default:
-               if (f->f_prevhost[0] != '\0') {
-                       v->iov_base = f->f_prevhost;
-                       v->iov_len = strlen(v->iov_base);
-                       v++;
-                       v->iov_base = " ";
-                       v->iov_len = 1;
-               } else {
-                       v->iov_base = "";
-                       v->iov_len = 0;
-                       v++;
-                       v->iov_base = "";
-                       v->iov_len = 0;
-               }
-               break;
+       if (f->f_prevhost[0] != '\0') {
+               v->iov_base = f->f_prevhost;
+               v->iov_len = strlen(v->iov_base);
+               v++;
+               v->iov_base = " ";
+               v->iov_len = 1;
+       } else {
+               v->iov_base = "";
+               v->iov_len = 0;
+               v++;
+               v->iov_base = "";
+               v->iov_len = 0;
        }
        v++;
 
@@ -2940,11 +2925,12 @@ markit(void)
 
        msg.m_pri = LOG_INFO;
        current_time(msg.m_timestamp);
+       strlcpy(msg.m_hostname, LocalHostName, sizeof(msg.m_hostname));
        msg.m_prog[0] = '\0';
        strlcpy(msg.m_msg, "-- MARK --", sizeof(msg.m_msg));
        MarkSeq += TIMERINTVL;
        if (MarkSeq >= MarkInterval) {
-               logmsg(&msg, MARK, LocalHostName);
+               logmsg(&msg, MARK);
                MarkSeq = 0;
        }
 
Index: regress/usr.sbin/syslogd/args-bufsize-native.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-bufsize-native.pl,v
retrieving revision 1.3
diff -u -p -r1.3 args-bufsize-native.pl
--- regress/usr.sbin/syslogd/args-bufsize-native.pl     31 Oct 2015 19:46:33 
-0000      1.3
+++ regress/usr.sbin/syslogd/args-bufsize-native.pl     25 Jan 2022 20:44:20 
-0000
@@ -15,6 +15,7 @@ use constant MAXLINE => 8192;
 my $time = "... .. ..:..:..";  # Oct 30 19:10:11
 # file entry is without <70> but with space, timestamp and hostname
 my $filelen = MAXLINE - 4 + length($time) + 1 + length($host) + 1;
+my $tcplen = MAXLINE + length($time) + 1 + length($host) + 1 + 1;
 
 our %args = (
     client => {
@@ -36,7 +37,7 @@ our %args = (
     server => {
        listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
        # syslog over TCP appends a \n
-       loggrep => { qr/^>>> 8209 <70>$time .{8188}\n/ => 1 },
+       loggrep => { qr/^>>> $tcplen <70>$time $host .{8188}\n/ => 1 },
     },
     file => {
        loggrep => { qr/^.{$filelen}\n/ => 1 },
Index: regress/usr.sbin/syslogd/args-client-multilisten.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-client-multilisten.pl,v
retrieving revision 1.4
diff -u -p -r1.4 args-client-multilisten.pl
--- regress/usr.sbin/syslogd/args-client-multilisten.pl 13 Sep 2017 00:35:53 
-0000      1.4
+++ regress/usr.sbin/syslogd/args-client-multilisten.pl 25 Jan 2022 20:44:20 
-0000
@@ -73,7 +73,7 @@ our %args = (
        ],
        func => sub { redo_connect(shift, sub {
            my $self = shift;
-           write_message($self, "client proto: ". $self->{connectproto});
+           write_message($self, "client proto; ". $self->{connectproto});
        })},
        loggrep => {
            qr/connect sock: (127.0.0.1|::1) \d+/ => 9,
@@ -100,9 +100,9 @@ our %args = (
     },
     file => {
        loggrep => {
-           qr/client proto: udp/ => '>=1',
-           qr/client proto: tcp/ => 3,
-           qr/client proto: tls/ => 3,
+           qr/client proto; udp/ => '>=1',
+           qr/client proto; tcp/ => 3,
+           qr/client proto; tls/ => 3,
            get_testgrep() => 1,
        }
     },
Index: regress/usr.sbin/syslogd/args-client-tcp-maxline.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-client-tcp-maxline.pl,v
retrieving revision 1.4
diff -u -p -r1.4 args-client-tcp-maxline.pl
--- regress/usr.sbin/syslogd/args-client-tcp-maxline.pl 19 Oct 2015 20:16:09 
-0000      1.4
+++ regress/usr.sbin/syslogd/args-client-tcp-maxline.pl 25 Jan 2022 20:44:20 
-0000
@@ -45,9 +45,9 @@ our %args = (
        }
     },
     server => {
-       # >>> <13>Jul  6 22:33:32 0123456789ABC...fgh
+       # >>> <13>Jul  6 22:33:32 localhost 0123456789ABC...fgh
        loggrep => {
-           qr/>>> .{19} /.generate_chars(MAX_UDPMSG-20).qr/$/ => 2,
+           qr/>>> .{29} /.generate_chars(MAX_UDPMSG-30).qr/$/ => 2,
        },
     },
     file => {
Index: regress/usr.sbin/syslogd/args-client-tcp-nontransp-maxline.pl
===================================================================
RCS file: 
/cvs/src/regress/usr.sbin/syslogd/args-client-tcp-nontransp-maxline.pl,v
retrieving revision 1.3
diff -u -p -r1.3 args-client-tcp-nontransp-maxline.pl
--- regress/usr.sbin/syslogd/args-client-tcp-nontransp-maxline.pl       19 Oct 
2015 20:16:09 -0000      1.3
+++ regress/usr.sbin/syslogd/args-client-tcp-nontransp-maxline.pl       25 Jan 
2022 20:44:20 -0000
@@ -47,9 +47,9 @@ our %args = (
        },
     },
     server => {
-       # >>> <13>Jul  6 22:33:32 0123456789ABC...fgh
+       # >>> <13>Jul  6 22:33:32 localhost 0123456789ABC...fgh
        loggrep => {
-           qr/>>> .{19} /.generate_chars(MAX_UDPMSG-20).qr/$/ => 2,
+           qr/>>> .{29} /.generate_chars(MAX_UDPMSG-30).qr/$/ => 2,
        },
     },
     file => {
Index: regress/usr.sbin/syslogd/args-client-tcp-octet-maxline.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-client-tcp-octet-maxline.pl,v
retrieving revision 1.4
diff -u -p -r1.4 args-client-tcp-octet-maxline.pl
--- regress/usr.sbin/syslogd/args-client-tcp-octet-maxline.pl   14 Jan 2018 
00:53:11 -0000      1.4
+++ regress/usr.sbin/syslogd/args-client-tcp-octet-maxline.pl   25 Jan 2022 
20:44:20 -0000
@@ -51,9 +51,9 @@ our %args = (
        },
     },
     server => {
-       # >>> <13>Jul  6 22:33:32 0123456789ABC...fgh
+       # >>> <13>Jul  6 22:33:32 localhost 0123456789ABC...fgh
        loggrep => {
-           qr/>>> .{19} /.generate_chars(MAX_UDPMSG-20).qr/$/ => 2,
+           qr/>>> .{29} /.generate_chars(MAX_UDPMSG-30).qr/$/ => 2,
        }
     },
     file => {
Index: regress/usr.sbin/syslogd/args-hostname.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-hostname.pl,v
retrieving revision 1.1
diff -u -p -r1.1 args-hostname.pl
--- regress/usr.sbin/syslogd/args-hostname.pl   13 Sep 2017 00:35:53 -0000      
1.1
+++ regress/usr.sbin/syslogd/args-hostname.pl   25 Jan 2022 20:44:20 -0000
@@ -65,14 +65,14 @@ our %args = (
     server => {
        loggrep => {
            qr/ client connect / => 3,
-           qr/:\d\d $host client connect proto: udp$/ => 1,
-           qr/:\d\d $host client connect proto: tcp$/ => 1,
-           qr/:\d\d $host client connect proto: tls$/ => 1,
+           qr/:\d\d 127.0.0.1 client connect proto: udp$/ => 1,
+           qr/:\d\d 127.0.0.1 client connect proto: tcp$/ => 1,
+           qr/:\d\d 127.0.0.1 client connect proto: tls$/ => 1,
            qr/ client logsock / => 4,
            qr/:\d\d $host syslogd-.*: client logsock type: native/ => 1,
            qr/:\d\d $host syslogd-.*: client logsock type: unix/ => 1,
-           qr/:\d\d $host syslogd-.*: client logsock type: udp/ => 1,
-           qr/:\d\d $host syslogd-.*: client logsock type: tcp/ => 1,
+           qr/:\d\d 127.0.0.1 syslogd-.*: client logsock type: udp/ => 1,
+           qr/:\d\d 127.0.0.1 syslogd-.*: client logsock type: tcp/ => 1,
        },
     },
     file => {
Index: regress/usr.sbin/syslogd/args-length-tcp.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-length-tcp.pl,v
retrieving revision 1.5
diff -u -p -r1.5 args-length-tcp.pl
--- regress/usr.sbin/syslogd/args-length-tcp.pl 15 Jun 2015 21:44:57 -0000      
1.5
+++ regress/usr.sbin/syslogd/args-length-tcp.pl 25 Jan 2022 20:44:20 -0000
@@ -27,12 +27,12 @@ our %args = (
     },
     server => {
        listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
-       # >>> 8213 <13>Jan 31 00:10:11 0123456789ABC...567\n
+       # >>> 8213 <13>Jan 31 00:10:11 localhost 0123456789ABC...567\n
        loggrep => {
            get_charlog() => 5,
-           qr/^>>> 8211 .{19} .{8190}$/ => 1,
-           qr/^>>> 8212 .{19} .{8191}$/ => 1,
-           qr/^>>> 8213 .{19} .{8192}$/ => 3,
+           qr/^>>> 8221 .{29} .{8190}$/ => 1,
+           qr/^>>> 8222 .{29} .{8191}$/ => 1,
+           qr/^>>> 8223 .{29} .{8192}$/ => 3,
        },
     },
 );
Index: regress/usr.sbin/syslogd/args-length-tls.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-length-tls.pl,v
retrieving revision 1.5
diff -u -p -r1.5 args-length-tls.pl
--- regress/usr.sbin/syslogd/args-length-tls.pl 15 Jun 2015 21:44:57 -0000      
1.5
+++ regress/usr.sbin/syslogd/args-length-tls.pl 25 Jan 2022 20:44:20 -0000
@@ -30,9 +30,9 @@ our %args = (
        # >>> 8213 <13>Jan 31 00:10:11 0123456789ABC...567\n
        loggrep => {
            get_charlog() => 5,
-           qr/^>>> 8211 .{19} .{8190}$/ => 1,
-           qr/^>>> 8212 .{19} .{8191}$/ => 1,
-           qr/^>>> 8213 .{19} .{8192}$/ => 3,
+           qr/^>>> 8221 .{29} .{8190}$/ => 1,
+           qr/^>>> 8222 .{29} .{8191}$/ => 1,
+           qr/^>>> 8223 .{29} .{8192}$/ => 3,
        },
     },
 );
Index: regress/usr.sbin/syslogd/args-length-udp.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-length-udp.pl,v
retrieving revision 1.5
diff -u -p -r1.5 args-length-udp.pl
--- regress/usr.sbin/syslogd/args-length-udp.pl 7 Jul 2015 18:03:11 -0000       
1.5
+++ regress/usr.sbin/syslogd/args-length-udp.pl 25 Jan 2022 20:44:20 -0000
@@ -27,10 +27,10 @@ our %args = (
        },
     },
     server => {
-       # >>> <13>Jan 31 00:10:11 0123456789ABC...lmn
+       # >>> <13>Jan 31 00:10:11 localhost 0123456789ABC...lmn
        loggrep => {
            get_charlog() => 5,
-           qr/^>>> .{19} /.generate_chars(MAX_UDPMSG-20).qr/$/ => 5,
+           qr/^>>> .{29} /.generate_chars(MAX_UDPMSG-30).qr/$/ => 5,
        },
     },
     file => {
Index: regress/usr.sbin/syslogd/args-localhost.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-localhost.pl,v
retrieving revision 1.6
diff -u -p -r1.6 args-localhost.pl
--- regress/usr.sbin/syslogd/args-localhost.pl  13 Jan 2022 10:34:58 -0000      
1.6
+++ regress/usr.sbin/syslogd/args-localhost.pl  25 Jan 2022 20:44:20 -0000
@@ -20,7 +20,7 @@ our %args = (
        loghost => '@localhost:$connectport',
        options => ["-u"],
        loggrep => {
-           qr/ from localhost, prog syslogd, msg /.get_testgrep() => 1,
+           qr/ from localhost, prog , msg /.get_testgrep() => 1,
        },
     },
     server => {
Index: regress/usr.sbin/syslogd/args-msgparsing-keephost.pl
===================================================================
RCS file: regress/usr.sbin/syslogd/args-msgparsing-keephost.pl
diff -N regress/usr.sbin/syslogd/args-msgparsing-keephost.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regress/usr.sbin/syslogd/args-msgparsing-keephost.pl        25 Jan 2022 
20:44:20 -0000
@@ -0,0 +1,110 @@
+# The client writes message with different timestamps to /dev/log.
+# The syslogd writes it into a file and through a pipe and to tty.
+# The syslogd passes it via UDP to the loghost.
+# The server receives the message on its UDP socket.
+# Find the message in client, file, pipe, console, user, syslogd, server log.
+# Check for the correct time conversion in file and server log.
+
+use strict;
+use warnings;
+use Socket;
+use Sys::Hostname;
+
+(my $host = hostname()) =~ s/\..*//;
+
+my $bsd = qr/[[:upper:]][[:lower:]]{2} [[:digit:] ][[:digit:]] 
[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/;
+
+our %args = (
+    client => {
+       connect => { domain => AF_UNIX },
+       func => sub {
+           my $self = shift;
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog[123]: 
testcontent 1");
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog: 
testcontent 2");
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog 
testcontent 3");
+           write_message($self, "Jan 13 07:06:00 testhost testprog: 
testcontent 4");
+           write_message($self, "<13> testhost testprog: testcontent 5");
+           write_message($self, "<13>testhost testprog: testcontent 6");
+           write_message($self, "<13>testhost testprog testcontent 7");
+           write_message($self, "<13> testprog: testcontent 8");
+           write_message($self, "<13>testprog: testcontent 9");
+           write_message($self, "<13>testprog testcontent 10");
+           write_message($self, "<13>Jan 13 07:06:00 testprog: testcontent 
11");
+           write_log($self);
+       },
+    },
+    syslogd => {
+       options => ["-H"],
+       conf => <<'EOF',
+!testprog
+*.*    $objdir/file-0.log
+!*
++testhost
+*.*    $objdir/file-1.log
+EOF
+    },
+    server => {
+       loggrep => {
+           qr/<13>Jan 13 07:06:00 testhost testprog\[123\]: testcontent 1$/ => 
1,
+           qr/<13>Jan 13 07:06:00 testhost testprog: testcontent 2$/ => 1,
+           qr/<13>Jan 13 07:06:00 testhost testprog testcontent 3$/ => 1,
+           qr/<13>Jan 13 07:06:00 testhost testprog: testcontent 4$/ => 1,
+           qr/<13>$bsd testhost testprog: testcontent 5$/ => 1,
+           qr/<13>$bsd testhost testprog: testcontent 6$/ => 1,
+           qr/<13>$bsd $host testhost testprog testcontent 7$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 8$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 9$/ => 1,
+           qr/<13>$bsd $host testprog testcontent 10$/ => 1,
+           qr/<13>Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+       },
+    },
+    file => {
+       loggrep => {
+           qr/Jan 13 07:06:00 testhost testprog\[123\]: testcontent 1$/ => 1,
+           qr/Jan 13 07:06:00 testhost testprog: testcontent 2$/ => 1,
+           qr/Jan 13 07:06:00 testhost testprog testcontent 3$/ => 1,
+           qr/Jan 13 07:06:00 testhost testprog: testcontent 4$/ => 1,
+           qr/$bsd testhost testprog: testcontent 5$/ => 1,
+           qr/$bsd testhost testprog: testcontent 6$/ => 1,
+           qr/$bsd $host testhost testprog testcontent 7$/ => 1,
+           qr/$bsd $host testprog: testcontent 8$/ => 1,
+           qr/$bsd $host testprog: testcontent 9$/ => 1,
+           qr/$bsd $host testprog testcontent 10$/ => 1,
+           qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+       },
+    },
+    multifile => [
+       {
+               loggrep => {
+                   qr/Jan 13 07:06:00 testhost testprog\[123\]: testcontent 
1$/ => 1,
+                   qr/Jan 13 07:06:00 testhost testprog: testcontent 2$/ => 1,
+                   qr/Jan 13 07:06:00 testhost testprog testcontent 3$/ => 0,
+                   qr/Jan 13 07:06:00 testhost testprog: testcontent 4$/ => 1,
+                   qr/$bsd testhost testprog: testcontent 5$/ => 1,
+                   qr/$bsd testhost testprog: testcontent 6$/ => 1,
+                   qr/$bsd $host testhost testprog testcontent 7$/ => 0,
+                   qr/$bsd $host testprog: testcontent 8$/ => 1,
+                   qr/$bsd $host testprog: testcontent 9$/ => 1,
+                   qr/$bsd $host testprog testcontent 10$/ => 0,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+               }
+       },
+       {
+               loggrep => {
+                   qr/Jan 13 07:06:00 testhost testprog\[123\]: testcontent 
1$/ => 1,
+                   qr/Jan 13 07:06:00 testhost testprog: testcontent 2$/ => 1,
+                   qr/Jan 13 07:06:00 testhost testprog testcontent 3$/ => 1,
+                   qr/Jan 13 07:06:00 testhost testprog: testcontent 4$/ => 1,
+                   qr/$bsd testhost testprog: testcontent 5$/ => 1,
+                   qr/$bsd testhost testprog: testcontent 6$/ => 1,
+                   qr/$bsd $host testhost testprog testcontent 7$/ => 0,
+                   qr/$bsd $host testprog: testcontent 8$/ => 0,
+                   qr/$bsd $host testprog: testcontent 9$/ => 0,
+                   qr/$bsd $host testprog testcontent 10$/ => 0,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 0,
+               }
+       }
+    ],
+);
+
+1;
Index: regress/usr.sbin/syslogd/args-msgparsing.pl
===================================================================
RCS file: regress/usr.sbin/syslogd/args-msgparsing.pl
diff -N regress/usr.sbin/syslogd/args-msgparsing.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regress/usr.sbin/syslogd/args-msgparsing.pl 25 Jan 2022 20:44:20 -0000
@@ -0,0 +1,110 @@
+# The client writes message with different timestamps to /dev/log.
+# The syslogd writes it into a file and through a pipe and to tty.
+# The syslogd passes it via UDP to the loghost.
+# The server receives the message on its UDP socket.
+# Find the message in client, file, pipe, console, user, syslogd, server log.
+# Check for the correct time conversion in file and server log.
+
+use strict;
+use warnings;
+use Socket;
+use Sys::Hostname;
+
+(my $host = hostname()) =~ s/\..*//;
+
+my $bsd = qr/[[:upper:]][[:lower:]]{2} [[:digit:] ][[:digit:]] 
[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/;
+
+our %args = (
+    client => {
+       connect => { domain => AF_UNIX },
+       func => sub {
+           my $self = shift;
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog[123]: 
testcontent 1");
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog: 
testcontent 2");
+           write_message($self, "<13>Jan 13 07:06:00 testhost testprog 
testcontent 3");
+           write_message($self, "Jan 13 07:06:00 testhost testprog: 
testcontent 4");
+           write_message($self, "<13> testhost testprog: testcontent 5");
+           write_message($self, "<13>testhost testprog: testcontent 6");
+           write_message($self, "<13>testhost testprog testcontent 7");
+           write_message($self, "<13> testprog: testcontent 8");
+           write_message($self, "<13>testprog: testcontent 9");
+           write_message($self, "<13>testprog testcontent 10");
+           write_message($self, "<13>Jan 13 07:06:00 testprog: testcontent 
11");
+           write_log($self);
+       },
+    },
+    syslogd => {
+       conf => <<'EOF',
+!testprog
+*.*    $objdir/file-0.log
+!*
++$host
+*.*    $objdir/file-1.log
+EOF
+    },
+    server => {
+       loggrep => {
+           qr/<13>Jan 13 07:06:00 $host testprog\[123\]: testcontent 1$/ => 1,
+           qr/<13>Jan 13 07:06:00 $host testprog: testcontent 2$/ => 1,
+           qr/<13>Jan 13 07:06:00 $host testprog testcontent 3$/ => 1,
+           qr/<13>Jan 13 07:06:00 $host testprog: testcontent 4$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 5$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 6$/ => 1,
+           qr/<13>$bsd $host testhost testprog testcontent 7$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 8$/ => 1,
+           qr/<13>$bsd $host testprog: testcontent 9$/ => 1,
+           qr/<13>$bsd $host testprog testcontent 10$/ => 1,
+           qr/<13>Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+       },
+    },
+    file => {
+       loggrep => {
+           qr/Jan 13 07:06:00 $host testprog\[123\]: testcontent 1$/ => 1,
+           qr/Jan 13 07:06:00 $host testprog: testcontent 2$/ => 1,
+           qr/Jan 13 07:06:00 $host testprog testcontent 3$/ => 1,
+           qr/Jan 13 07:06:00 $host testprog: testcontent 4$/ => 1,
+           qr/$bsd $host testprog: testcontent 5$/ => 1,
+           qr/$bsd $host testprog: testcontent 6$/ => 1,
+           qr/$bsd $host testhost testprog testcontent 7$/ => 1,
+           qr/$bsd $host testprog: testcontent 8$/ => 1,
+           qr/$bsd $host testprog: testcontent 9$/ => 1,
+           qr/$bsd $host testprog testcontent 10$/ => 1,
+           qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+       },
+    },
+    multifile => [
+       {
+               loggrep => {
+                   qr/Jan 13 07:06:00 $host testprog\[123\]: testcontent 1$/ 
=> 1,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 2$/ => 1,
+                   qr/Jan 13 07:06:00 $host testprog testcontent 3$/ => 0,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 4$/ => 1,
+                   qr/$bsd $host testprog: testcontent 5$/ => 1,
+                   qr/$bsd $host testprog: testcontent 6$/ => 1,
+                   qr/$bsd $host testhost testprog testcontent 7$/ => 0,
+                   qr/$bsd $host testprog: testcontent 8$/ => 1,
+                   qr/$bsd $host testprog: testcontent 9$/ => 1,
+                   qr/$bsd $host testprog testcontent 10$/ => 0,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+               }
+       },
+       # Everything should match, since syslogd(8) defaults to overwriting 
hostname
+       {
+               loggrep => {
+                   qr/Jan 13 07:06:00 $host testprog\[123\]: testcontent 1$/ 
=> 1,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 2$/ => 1,
+                   qr/Jan 13 07:06:00 $host testprog testcontent 3$/ => 1,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 4$/ => 1,
+                   qr/$bsd $host testprog: testcontent 5$/ => 1,
+                   qr/$bsd $host testprog: testcontent 6$/ => 1,
+                   qr/$bsd $host testhost testprog testcontent 7$/ => 1,
+                   qr/$bsd $host testprog: testcontent 8$/ => 1,
+                   qr/$bsd $host testprog: testcontent 9$/ => 1,
+                   qr/$bsd $host testprog testcontent 10$/ => 1,
+                   qr/Jan 13 07:06:00 $host testprog: testcontent 11$/ => 1,
+               }
+       }
+    ],
+);
+
+1;
Index: regress/usr.sbin/syslogd/args-rsyslog-client-tcp.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-rsyslog-client-tcp.pl,v
retrieving revision 1.5
diff -u -p -r1.5 args-rsyslog-client-tcp.pl
--- regress/usr.sbin/syslogd/args-rsyslog-client-tcp.pl 5 Apr 2017 22:32:14 
-0000       1.5
+++ regress/usr.sbin/syslogd/args-rsyslog-client-tcp.pl 25 Jan 2022 20:44:20 
-0000
@@ -24,11 +24,13 @@ our %args = (
        },
     },
     syslogd => {
-       options => ["-T", "127.0.0.1:514"],
+       options => ["-H", "-T", "127.0.0.1:514"],
        loggrep => {
-           get_testgrep() => 1,
            qr/syslogd\[\d+\]: tcp logger .* accepted/ => 1,
        },
+    },
+    file => {
+       get_testgrep() => 1,
     },
 );
 
Index: regress/usr.sbin/syslogd/args-rsyslog-client-udp.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-rsyslog-client-udp.pl,v
retrieving revision 1.3
diff -u -p -r1.3 args-rsyslog-client-udp.pl
--- regress/usr.sbin/syslogd/args-rsyslog-client-udp.pl 3 May 2016 17:05:31 
-0000       1.3
+++ regress/usr.sbin/syslogd/args-rsyslog-client-udp.pl 25 Jan 2022 20:44:20 
-0000
@@ -24,7 +24,12 @@ our %args = (
        },
     },
     syslogd => {
-       options => ["-U", "127.0.0.1:514"],
+       options => ["-H", "-U", "127.0.0.1:514"],
+       loggrep => {
+       },
+    },
+    file => {
+       get_testgrep() => 1,
     },
 );
 
Index: regress/usr.sbin/syslogd/args-zulu.pl
===================================================================
RCS file: /cvs/src/regress/usr.sbin/syslogd/args-zulu.pl,v
retrieving revision 1.3
diff -u -p -r1.3 args-zulu.pl
--- regress/usr.sbin/syslogd/args-zulu.pl       12 Sep 2017 15:24:21 -0000      
1.3
+++ regress/usr.sbin/syslogd/args-zulu.pl       25 Jan 2022 20:44:20 -0000
@@ -23,14 +23,14 @@ our %args = (
        func => sub {
            my $self = shift;
            write_message($self, "no time");
-           write_message($self, "Oct 11 22:14:15 bsd time");
-           write_message($self, "1985-04-12T23:20:50Z iso time");
-           write_message($self, "1985-04-12T23:20:50.52Z iso frac");
-           write_message($self, "1985-04-12T19:20:50.52-04:00 iso offset");
-           write_message($self, "2003-10-11T22:14:15.003Z iso milisec");
-           write_message($self, "2003-08-24T05:14:15.000003-07:00 iso full");
+           write_message($self, "Oct 11 22:14:15 $host bsd time");
+           write_message($self, "1985-04-12T23:20:50Z $host iso time");
+           write_message($self, "1985-04-12T23:20:50.52Z $host iso frac");
+           write_message($self, "1985-04-12T19:20:50.52-04:00 $host iso 
offset");
+           write_message($self, "2003-10-11T22:14:15.003Z $host iso milisec");
+           write_message($self, "2003-08-24T05:14:15.000003-07:00 $host iso 
full");
            write_message($self, "2003-08-24T05:14:15.000000003-07:00 invalid");
-           write_message($self, "- nil time");
+           write_message($self, "- $host nil time");
            write_message($self, "2003-08-24T05:14:15.000003-07:00space");
            write_message($self, "2003-08-24T05:14:15.-07:00 nofrac");
            write_message($self, "2003-08-24T05:14:15.1234567-07:00 longfrac");
@@ -43,19 +43,19 @@ our %args = (
     },
     server => {
        loggrep => {
-           qr/>$iso no time$/ => 1,
-           qr/>$iso bsd time$/ => 1,
-           qr/>1985-04-12T23:20:50Z iso time$/ => 1,
-           qr/>1985-04-12T23:20:50.52Z iso frac$/ => 1,
-           qr/>1985-04-12T19:20:50.52-04:00 iso offset$/ => 1,
-           qr/>2003-10-11T22:14:15.003Z iso milisec$/ => 1,
-           qr/>2003-08-24T05:14:15.000003-07:00 iso full$/ => 1,
-           qr/>$iso 2003-08-24T05:14:15.000000003-07:00 invalid$/ => 1,
-           qr/>$iso nil time$/ => 1,
-           qr/>$iso 2003-08-24T05:14:15.000003-07:00space$/ => 1,
-           qr/>$iso 2003-08-24T05:14:15.-07:00 nofrac$/ => 1,
-           qr/>$iso 2003-08-24T05:14:15.1234567-07:00 longfrac$/ => 1,
-           qr/>$iso 1985-04-12T23:20:50X zulu$/ => 1,
+           qr/>$iso $host no time$/ => 1,
+           qr/>$iso $host bsd time$/ => 1,
+           qr/>1985-04-12T23:20:50Z $host iso time$/ => 1,
+           qr/>1985-04-12T23:20:50.52Z $host iso frac$/ => 1,
+           qr/>1985-04-12T19:20:50.52-04:00 $host iso offset$/ => 1,
+           qr/>2003-10-11T22:14:15.003Z $host iso milisec$/ => 1,
+           qr/>2003-08-24T05:14:15.000003-07:00 $host iso full$/ => 1,
+           qr/>$iso $host 2003-08-24T05:14:15.000000003-07:00 invalid$/ => 1,
+           qr/>$iso $host nil time$/ => 1,
+           qr/>$iso $host 2003-08-24T05:14:15.000003-07:00space$/ => 1,
+           qr/>$iso $host 2003-08-24T05:14:15.-07:00 nofrac$/ => 1,
+           qr/>$iso $host 2003-08-24T05:14:15.1234567-07:00 longfrac$/ => 1,
+           qr/>$iso $host 1985-04-12T23:20:50X zulu$/ => 1,
        },
     },
     file => {

Reply via email to