>>> Lennart Poettering <lennart@xxxxxxxxxxxxxx> schrieb am 28.04.2022 um 10:27 in Nachricht <YmpQCYN0Y/gxlzGU@gardel-login>: > On Do, 28.04.22 09:32, Ulrich Windl (Ulrich.Windl@xxxxxx‑regensburg.de) wrote: > >> Actually I wasn't quite sure about the default config in SLES12. >> It seems the flow is journald ‑> local rsyslogd ‑> remote syslogd >> >> > rsyslogd already knows if messages are UTF‑8 because the system's $LANG >> > (well, nl_langinfo) says so. And if rsyslog can't trust that for some >> > reason (e.g. because a user might have a different locale), then >> > systemd‑journald won't be able to trust it either, so it won't know whether >> > it could add the BOM. >> >> How could a remote syslog server know what the locale on the sending system >> is? > > Your local rsyslogd could add the BOM when it transforms journal > messages to syslog datagrams. > >> > RFC 3164 over the network to a remote server? Outside the scope for >> > systemd, since it doesn't generate the network packets; your local rsyslogd >> > forwarder does. (Also, why RFC 3164 and not 5425?) >> >> If you look outside the world of systemd, about 99% of systems create the > RFC >> 3164 type of messages. > > That's a wild claim, and simply wrong actually. Well actually as systemd cannot send syslog messages to remote, which systems do you know that send RFC 5424 messages? Actually I know none here. > > I am pretty sure that more than 50% of syslog messages generated on > this earth probably are synthesized by glibc's syslog() API. And that > turns out to be neither conformant to RFC 3164 nor to RFC 5425. No idea. Can you give an example? > > What glibc sends is close to RFC 3164 but omits one key field that > isn't really optionally according to RFC 3164: the 'HOSTNAME' field. Maybe the API is not used correctly. The RFC 3164 says: "A relay will add a TIMESTAMP and SHOULD add a HOSTNAME as follows (...)" So when sending to any remote syslog a HOSTNAME should be there. (It's like a MTA adding a Message-ID (and other fields) if none is present) Most notable the RFC seems to allow a missing hostname initially. > > systemd is focussed on reality: we generate and process the same > format glibc generates. I'm wondering which API all those programs use that create correct syslog entries. I tried with my own program: It sends: connect(1, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0 sendto(1, "<31>Apr 28 11:08:32 iotwatch[239"..., 56, MSG_NOSIGNAL, NULL, 0) = 56 What's logged is: Apr 28 11:08:32 host-name iotwatch[239... Also from the syntax being sent by the application, one cannot really say whether the hostname is missing. Maybe the trick is that /dev/log is specified as source for _local_ syslog messages (so that there's no reason or sense in supplying the local hostname). Also I'm not sure whether the messages in /dev/log are covered by the RFC. Regards, Ulrich Windl > > Lennart > > ‑‑ > Lennart Poettering, Berlin