# service syslogd start Starting syslogd. /etc/rc.d/syslogd: WARNING: failed to start syslogd -rw-r--r-- 1 root wheel 0 May 20 19:26 /var/run/syslogd.sockets lrwxr-xr-x 1 root wheel 12 May 20 19:19 /dev/log -> /var/run/log 16017: socket(PF_LOCAL,SOCK_DGRAM|SOCK_CLOEXEC,0) = 1 (0x1) 16017: connect(1,{ AF_UNIX "/var/run/logpriv" },106) ERR#2 'No such file or directory' 16017: connect(1,{ AF_UNIX "/var/run/log" },106) ERR#2 'No such file or directory' 16017: connect(1,{ AF_UNIX "/dev/log" },106) ERR#2 'No such file or directory' 16017: close(1) = 0 (0x0) 16017: sendto(-1,"<13>1 2019-05-20T19:25:10.923432"...,123,0,NULL,0) ERR#9 'Bad file descriptor'
Thank you for the report Jason What version of FreeBSD is currently installed (uname -a) and please include the following command output as an attachment: - cat /etc/rc.conf - cat /etc/syslog.conf - ls -la / - ls -la /var/log - ls -la /var
(In reply to Kubilay Kocak from comment #1) FreeBSD safe 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 GENERIC amd64 # cat /etc/rc.conf ipsec_enable="YES" zfs_enable="YES" hostname="safe" syslogd_flags="-ss" devd_enable="NO" dumpdev="NO" sendmail_enable="NONE" moused_ums0_enable="NO" ntpd_enable="NO" chronyd_enable="YES" chronyd_flags="-4" sshd_enable="YES" sshd_flags="-4 -g 3" harvest_mask="351" ifconfig_cxl0="inet 10.141.254.2/16 mtu 9198 -vlanmtu -vlanhwtag -vlanhwcsum -vlanhwtso -tso6 -rxcsum6 -txcsum6 description internalnet" ifconfig_cxl1_ipv6="inet6 2620:10e:6024:f004::ca08 prefixlen 64 mtu 9000 -arp -vlanmtu -vlanhwtag -vlanhwcsum -vlanhwtso -tso4 -tso6 -rxcsum -txcsum description CCSA-HPC" ipv6_network_interfaces="cxl1" ipv6_static_routes="GlobalUnicast" ipv6_route_GlobalUnicast="-inet6 2000::/3 fe80::1%cxl1 -mtu 9000" firewall_enable="YES" firewall_script="/etc/ipfw.rules" clear_tmp_X="NO" # cat /etc/syslog.conf # $FreeBSD: releng/12.0/usr.sbin/syslogd/syslog.conf 338146 2018-08-21 17:01:47Z brd $ # # Spaces ARE valid field separators in this file. However, # other *nix-like systems still insist on using tabs as field # separators. If you are sharing this file between systems, you # may want to use only tabs as field separators here. # Consult the syslog.conf(5) manpage. *.err;kern.warning;auth.notice;mail.crit /dev/console *.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages security.* /var/log/security auth.info;authpriv.info /var/log/auth.log mail.info /var/log/maillog cron.* /var/log/cron !-devd *.=debug /var/log/debug.log *.emerg * # uncomment this to log all writes to /dev/console to /var/log/console.log # touch /var/log/console.log and chmod it to mode 600 before it will work #console.info /var/log/console.log # uncomment this to enable logging of all log messages to /var/log/all.log # touch /var/log/all.log and chmod it to mode 600 before it will work #*.* /var/log/all.log # uncomment this to enable logging to a remote loghost named loghost #*.* @loghost # uncomment these if you're running inn # news.crit /var/log/news/news.crit # news.err /var/log/news/news.err # news.notice /var/log/news/news.notice # Uncomment this if you wish to see messages produced by devd # !devd # *.>=notice /var/log/devd.log !* include /etc/syslog.d include /usr/local/etc/syslog.d # ls -al / total 40 drwxr-xr-x 19 root wheel 23 May 8 01:52 . drwxr-xr-x 19 root wheel 23 May 8 01:52 .. -rw-r--r-- 2 root wheel 951 Apr 6 16:57 .cshrc -rw-r--r-- 2 root wheel 470 Apr 6 16:57 .profile drwxr-xr-x 2 root wheel 46 Apr 6 17:05 bin drwxr-xr-x 10 root wheel 63 Apr 6 21:15 boot dr-xr-xr-x 22 root wheel 512 May 8 01:51 dev -rw------- 1 root wheel 4096 May 8 01:52 entropy drwxr-xr-x 25 root wheel 113 May 7 17:33 etc drwxr-xr-x 4 root sys 4 Jan 31 2017 home drwxr-xr-x 4 root wheel 61 Apr 6 17:07 lib drwxr-xr-x 3 root wheel 4 Apr 6 16:57 libexec drwxr-xr-x 2 root wheel 2 Sep 29 2016 media drwxr-xr-x 2 root wheel 2 Sep 29 2016 mnt drwxr-xr-x 2 root wheel 2 Apr 6 16:57 net dr-xr-xr-x 2 root wheel 2 Sep 29 2016 proc drwxr-xr-x 2 root wheel 150 Apr 6 17:05 rescue drwxr-xr-x 4 root wheel 24 May 20 19:28 root drwxr-xr-x 2 root wheel 137 Apr 6 17:05 sbin lrwxr-xr-x 1 root wheel 11 Sep 29 2016 sys -> usr/src/sys drwxrwxrwt 3 root wheel 5 May 21 03:01 tmp drwxr-xr-x 15 root wheel 15 Feb 5 2017 usr drwxr-xr-x 24 root wheel 24 May 8 01:52 var # ls -la /var/log total 253 drwxr-xr-x 2 root wheel 75 May 21 00:00 . drwxr-xr-x 24 root wheel 24 May 8 01:52 .. -rw------- 1 root wheel 25251 Apr 6 20:21 auth.log -rw------- 1 root wheel 1820 Jan 1 00:00 auth.log.0.bz2 -rw------- 1 root wheel 8408 Sep 20 2018 auth.log.1.bz2 -rw------- 1 root wheel 6353 Jan 1 2018 auth.log.2.bz2 -rw------- 1 root wheel 8089 Aug 11 2017 auth.log.3.bz2 -rw------- 1 root wheel 8117 Mar 8 2017 auth.log.4.bz2 -rw------- 1 root wheel 8063 Jan 30 2017 auth.log.5.bz2 -rw------- 1 root wheel 2006 Jan 1 2017 auth.log.6.bz2 -rw------- 1 root wheel 82288 Apr 6 20:22 cron -rw------- 1 root wheel 6464 Apr 1 06:00 cron.0.bz2 -rw------- 1 root wheel 6484 Mar 25 03:00 cron.1.bz2 -rw------- 1 root wheel 6476 Mar 17 23:00 cron.2.bz2 -rw-r----- 1 root wheel 12353 May 21 03:01 daily.log -rw-r----- 1 root wheel 3098 May 21 00:00 daily.log.0.bz2 -rw-r----- 1 root wheel 3229 May 20 00:00 daily.log.1.bz2 -rw-r----- 1 root wheel 3055 May 19 00:00 daily.log.2.bz2 -rw-r----- 1 root wheel 3047 May 18 00:00 daily.log.3.bz2 -rw-r----- 1 root wheel 3029 May 17 00:00 daily.log.4.bz2 -rw-r----- 1 root wheel 3027 May 16 00:00 daily.log.5.bz2 -rw-r----- 1 root wheel 3013 May 15 00:00 daily.log.6.bz2 -rw------- 1 root wheel 2266 Apr 6 17:06 debug.log -rw-r--r-- 1 root wheel 59 Oct 12 2016 devd.log -rw------- 1 root wheel 23390 May 19 03:01 dmesg.today -rw------- 1 root wheel 23125 May 8 03:01 dmesg.yesterday -rw------- 1 root wheel 696 May 16 03:01 ipfw.today -rw------- 1 root wheel 685 May 9 03:01 ipfw.yesterday -rw-r--r-- 1 root wheel 59 Oct 12 2016 lpd-errs -rw-r----- 1 root wheel 59 May 21 00:00 maillog -rw-r----- 1 root wheel 119 May 21 00:00 maillog.0.bz2 -rw-r----- 1 root wheel 119 May 20 00:00 maillog.1.bz2 -rw-r----- 1 root wheel 112 May 19 00:00 maillog.2.bz2 -rw-r----- 1 root wheel 115 May 18 00:00 maillog.3.bz2 -rw-r----- 1 root wheel 120 May 17 00:00 maillog.4.bz2 -rw-r----- 1 root wheel 120 May 16 00:00 maillog.5.bz2 -rw-r----- 1 root wheel 119 May 15 00:00 maillog.6.bz2 -rw-r--r-- 1 root wheel 94975 Apr 6 20:22 messages -rw-r--r-- 1 root wheel 2481 Jan 1 00:00 messages.0.bz2 -rw-r--r-- 1 root wheel 10069 Jan 1 2018 messages.1.bz2 -rw-r--r-- 1 root wheel 11384 Feb 7 2017 messages.2.bz2 -rw-r--r-- 1 root wheel 11345 Jan 12 2017 messages.3.bz2 -rw-r--r-- 1 root wheel 5630 Jan 10 2017 messages.4.bz2 -rw-r----- 1 root wheel 216 May 1 05:30 monthly.log -rw-r----- 1 root wheel 205 May 1 00:00 monthly.log.0.bz2 -rw-r----- 1 root wheel 202 Apr 1 00:00 monthly.log.1.bz2 -rw-r----- 1 root wheel 197 Jul 1 2018 monthly.log.10.bz2 -rw-r----- 1 root wheel 202 Jun 1 2018 monthly.log.11.bz2 -rw-r----- 1 root wheel 203 Mar 1 00:00 monthly.log.2.bz2 -rw-r----- 1 root wheel 204 Feb 1 00:00 monthly.log.3.bz2 -rw-r----- 1 root wheel 202 Jan 1 00:00 monthly.log.4.bz2 -rw-r----- 1 root wheel 200 Dec 1 00:00 monthly.log.5.bz2 -rw-r----- 1 root wheel 202 Nov 1 2018 monthly.log.6.bz2 -rw-r----- 1 root wheel 201 Oct 1 2018 monthly.log.7.bz2 -rw-r----- 1 root wheel 198 Sep 1 2018 monthly.log.8.bz2 -rw-r----- 1 root wheel 204 Aug 1 2018 monthly.log.9.bz2 -rw------- 1 root wheel 4782 May 2 03:01 mount.today -rw------- 1 root wheel 4610 Apr 23 03:01 mount.yesterday -rw-r----- 1 root network 59 Oct 12 2016 ppp.log -rw------- 1 root wheel 59 Oct 12 2016 security -rw------- 1 root wheel 3112 Apr 7 03:01 setuid.today -rw------- 1 root wheel 3304 Dec 13 2016 setuid.yesterday -rw------- 1 root wheel 154 Apr 6 18:16 userlog -rw-r--r-- 1 root wheel 197 May 21 11:19 utx.lastlogin -rw-r--r-- 1 root wheel 2652 May 21 11:19 utx.log -rw-r--r-- 1 root wheel 6910 May 1 05:00 utx.log.0 -rw-r--r-- 1 root wheel 3441 Apr 1 05:00 utx.log.1 -rw-r--r-- 1 root wheel 888 Mar 1 05:00 utx.log.2 -rw-r----- 1 root wheel 162 May 18 04:15 weekly.log -rw-r----- 1 root wheel 193 May 18 00:00 weekly.log.0.bz2 -rw-r----- 1 root wheel 194 May 11 00:00 weekly.log.1.bz2 -rw-r----- 1 root wheel 197 May 4 00:00 weekly.log.2.bz2 -rw-r----- 1 root wheel 197 Apr 27 00:00 weekly.log.3.bz2 -rw-r----- 1 root wheel 195 Apr 20 00:00 weekly.log.4.bz2 -rw------- 1 root wheel 59 Oct 12 2016 xferlog # ls -la /var total 21 drwxr-xr-x 24 root wheel 24 May 8 01:52 . drwxr-xr-x 19 root wheel 23 May 8 01:52 .. drwxr-xr-x 2 root wheel 2 Sep 29 2016 account drwxr-xr-x 4 root wheel 4 Sep 29 2016 at drwxr-x--- 4 root audit 4 Sep 29 2016 audit drwxrwx--- 2 root authpf 2 Sep 29 2016 authpf drwxr-x--- 2 root wheel 15 May 21 03:01 backups drwxr-xr-x 3 root wheel 3 Oct 13 2016 cache drwxr-x--- 2 root wheel 3 Sep 29 2016 crash drwxr-x--- 3 root wheel 3 Sep 29 2016 cron drwxr-xr-x 14 root wheel 21 May 17 15:26 db dr-xr-xr-x 2 root wheel 2 Sep 29 2016 empty drwxrwxr-x 2 root games 2 Sep 29 2016 games drwx------ 2 root wheel 2 Sep 29 2016 heimdal drwxr-xr-x 2 root wheel 75 May 21 00:00 log drwxrwxr-x 2 root mail 3 Apr 6 18:16 mail drwxr-xr-x 2 daemon wheel 3 Oct 12 2016 msgs drwxr-xr-x 2 root wheel 2 Sep 29 2016 preserve drwxr-xr-x 6 root wheel 15 May 21 03:01 run drwxrwxr-x 2 root daemon 2 Sep 29 2016 rwho drwxr-xr-x 9 root wheel 9 Sep 29 2016 spool drwxrwxrwt 3 root wheel 3 Oct 23 2016 tmp drwxr-xr-x 3 unbound unbound 3 Sep 29 2016 unbound drwxr-xr-x 2 root wheel 4 Apr 6 17:04 yp
Figured out why. /etc/services did not contain the "syslog" udp service.
Note, syslogd was started with "-ss" option, and shouldn't need to listen on a network socket.
In FreeBSD 13.0 syslogd -ss still needs an entry for syslog 514/udp in /etc/services to be able to start.
Hello, I stumbled across this PR while debugging: 'logmsg: pri 53, flags 0, from , msg getaddrinfo failed for syslog: Name does not resolve' Since services(5) does include 'syslog 514/udp' in FreeBSD 14.1, my problem isn't exactly the same, but related. syslogd(8) doesn't stat in jails which are neither vnet-enabled nor do have a shared-ip assigned. I tracked it down to socksetup() in src/usr.sbin/syslogd/syslogd.c. In main(), after getopt processing, if no -b as CLI arg was specified [line 742]: /* Listen by default: *:514 if no -b flag. */ if (bflag == 0) addpeer(&(struct peer){ .pe_serv = "syslog" }); addpeer() is unconditionally called to add service "syslog" to peer.pe_serv, even if ( SecureMode > 1 ). Then, in socksetup(), getaddrinfo() fails in jails as decribed above (no vnet, no shared-IP). Unfortunately, that's the part I don't understand. Neither why it fails, nor why this unconditionally causes die(0); [line 3840]. The check which should make the check result meaningless comes _after_ die(0) [line 3845]: if (res->ai_family != AF_LOCAL && SecureMode > 1) { /* Only AF_LOCAL in secure mode. */ continue; } My C skills are too weak to propose a patch, but at least I found a suitable workaround for the moment: Adding -b 127.0.0.1 (in addition to -ss) as CLI arg prevents from die(0);. Anyone familiar with getaddrinfo(3) who can judge if the problem really is in the syslogd code path as outlined above, or if the real bug is that getaddrinf(3) fails in jails without a shared-IP configured (and not a vnet lo0)? Thanks, -harry
Created attachment 253432 [details] proposed patch Here's a patch and test case which I believe will fix the problem. Some testing would be appreciated.
(In reply to Mark Johnston from comment #7) Thanks a lot! I was wondering how comes that your diff calls getaddrinfo() differently... and noticed that HEAD has a significant newer version, tuned by Jake Freeland mainly. In main f30b063ee667 »syslogd: Only use peerlist during flag parsing« the check in question was moved from socksetup() to addsock() and the unconditional addpeer() was removed. So I thought it's worth giving the unmodified HEAD version a try†, especially because the commits were tagged to be MFCd after 3 weeks. And lucky I was: Only reading/understanding parts of the diff, it turns out that HEAD version doesn't terminate in jails without IP/vnet assigned if '-ss' was passed as CLI arg (while (the default) '-s' still makes syslogd(8) terminate with »pri 53, flags 0, from test, msg exiting on signal 2« in such jails). For completeness I also successfully tested the patched stable/14 version of syslogd(8), with Mark's slightly adopted diff (same result as with HEAD version, '-ss' pased starts while '-s' terminates in jails withoutIP/vnet): (note pe->pe_name instead of name and returning with an int) --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -3825,6 +3825,14 @@ socksetup(struct peer *pe) if (pe->pe_serv == NULL) pe->pe_serv = "syslog"; error = getaddrinfo(pe->pe_name, pe->pe_serv, &hints, &res0); + if (error == EAI_NONAME && pe->pe_name == NULL && SecureMode > 1) { + /* + * If we're in secure mode, we won't open inet sockets anyway. + * This failure can arise legitimately when running in a jail + * without networking. + */ + return (0); + } if (error) { char *msgbuf; So I guess instead of patching, MFCing is the preferred solution after one year in HEAD. Unfortunately I don't have any environment where I could test all the network functionality of syslogd(8). Neither sending nor collecting via inet... Ever since I discovered 'netstat -an' as young rookie, I'm passing '-ss' to syslogd(8). How to find out if syslogd_flags="-ss" (instead of ="-s") would be the better default in /etc/defaults/rc.conf? But that's unrelated to this PR. †although I new this would make me upset about git(666) once more... I lost the wrestle again, so I took the head src tar and copied usr.sbin/syslogd into my stable/14 checkout (I _always_ end up with an unusable local git repo and need to re-clone and start from scratch :-( I rarely needed much svn(1) help and never messed it up...) If somebody could tell me how I could have accomplished getting an diff between the HEAD commit as in stable/14 and head in HEAD, I'd highly appreciate. I guess I'd always need to separately clone the HEAD repo 1st, which is ridiculous imho.
(In reply to Harald Schmalzbauer from comment #8) The patch is still needed in main - I verified that syslogd -ss will abort if getaddrinfo() fails. > How to find out if syslogd_flags="-ss" (instead of ="-s") would be the better default in /etc/defaults/rc.conf? It would be a better default, most hosts are not logging messages from remote servers. It should be possible to automatically parse syslog.conf and look for remote logging rules; if there are none, it is safe to set -ss.
(In reply to Mark Johnston from comment #9) > The patch is still needed in main - I verified that syslogd -ss will abort if getaddrinfo() fails. Urhg, thought I messed up the test this morning, but repetition shows same result here! Here's the relevant getaddrinfo() part of git diff usr.sbin/syslogd/syslogd.c ... -static int -addsock(struct addrinfo *ai, struct socklist *sl0) +static void +addsock(const char *name, const char *serv, mode_t mode) { + struct addrinfo hints = { }, *res, *res0; struct socklist *sl; + int error; + char *cp, *msgbuf; - /* Copy *ai->ai_addr to the tail of struct socklist if any. */ - sl = calloc(1, sizeof(*sl) + ((ai != NULL) ? ai->ai_addrlen : 0)); + /* + * We have to handle this case for backwards compatibility: + * If there are two (or more) colons but no '[' and ']', + * assume this is an inet6 address without a service. + */ + if (name != NULL) { +#ifdef INET6 + if (name[0] == '[' && + (cp = strchr(name + 1, ']')) != NULL) { + name = &name[1]; + *cp = '\0'; + if (cp[1] == ':' && cp[2] != '\0') + serv = cp + 2; + } else { +#endif + cp = strchr(name, ':'); + if (cp != NULL && strchr(cp + 1, ':') == NULL) { + *cp = '\0'; + if (cp[1] != '\0') + serv = cp + 1; + if (cp == name) + name = NULL; + } +#ifdef INET6 + } +#endif + } + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + if (name != NULL) + dprintf("Trying peer: %s\n", name); + if (serv == NULL) + serv = "syslog"; + error = getaddrinfo(name, serv, &hints, &res0); + if (error) { + asprintf(&msgbuf, "getaddrinfo failed for %s%s: %s", + name == NULL ? "" : name, serv, + gai_strerror(error)); + errno = 0; + if (msgbuf == NULL) + logerror(gai_strerror(error)); + else + logerror(msgbuf); + free(msgbuf); + die(0); + } + for (res = res0; res != NULL; res = res->ai_next) { + sl = socksetup(res, name, mode); + if (sl == NULL) + continue; + STAILQ_INSERT_TAIL(&shead, sl, next); + } + freeaddrinfo(res0); +} + +static void +addfile(int fd) +{ + struct socklist *sl = calloc(1, sizeof(*sl)); if (sl == NULL) err(1, "malloc failed"); - *sl = *sl0; - if (ai != NULL) { - memcpy(&sl->sl_ai, ai, sizeof(*ai)); - if (ai->ai_addrlen > 0) { - memcpy((sl + 1), ai->ai_addr, ai->ai_addrlen); - sl->sl_sa = (struct sockaddr *)(sl + 1); - } else - sl->sl_sa = NULL; - } + sl->sl_socket = fd; + sl->sl_recv = socklist_recv_file; STAILQ_INSERT_TAIL(&shead, sl, next); - - return (0); } int main(int argc, char *argv[]) { - int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; - fd_set *fdsr = NULL; - struct timeval tv, *tvp; - struct peer *pe; + struct sigaction act = { }; + struct kevent ev; struct socklist *sl; - pid_t ppid = 1, spid; + pid_t spid; + int ch, kq, ppipe_w = -1, s; char *p; + bool bflag = false, pflag = false, Sflag = false; if (madvise(NULL, 0, MADV_PROTECT) != 0) dprintf("madvise() failed: %s\n", strerror(errno)); So I'm compiling the unmodified HEAD version. SHA1 (/usr/obj/1401502.Haswell-AlderLake/amd64.amd64/usr.sbin/syslogd/syslogd) = 28e719d6080b37d4eac1a6807b57e2a881c3b407 This is my test run in an production-like test-jail: root@test:~ # ls -la /usr/sbin/syslogd* -r-xr-xr-x 1 root wheel 57288 Sep 9 09:08 /usr/sbin/syslogd -r-xr-xr-x 1 root wheel 65688 Sep 9 14:35 /usr/sbin/syslogd.head -r-xr-xr-x 1 root wheel 57288 Sep 7 10:34 /usr/sbin/syslogd.stable14 root@test:~ # sha1 /usr/sbin/syslogd* SHA1 (/usr/sbin/syslogd) = 7f083790dd3e5042f8bb9df8801c1baa26f18144 SHA1 (/usr/sbin/syslogd.head) = 28e719d6080b37d4eac1a6807b57e2a881c3b407 SHA1 (/usr/sbin/syslogd.stable14) = aceff0f45b668d649e8001615e0034bf6f88e9ce root@test:~ # syslogd.stable14 -ss -dv can't open /dev/klog (2) logmsg: pri 53, flags 0, from , msg getaddrinfo failed for syslog: Name does not resolve root@test:~ # syslogd.head -ss -dv can't open /dev/klog (2) Trying peer: /var/run/log new socket fd is 5 listening on socket sending on socket Trying peer: /var/run/logpriv new socket fd is 6 listening on socket sending on socket off & running.... init loading timezone data via tzset() cfline("*.err;kern.warning;auth.notice;mail.crit /dev/console", f, "*", "*", "*") /dev/console: No such file or directory logmsg: pri 53, flags 0, from test, msg /dev/console: No such file or directory cfline("*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages", f, "*", "*", "*") cfline("security.* /var/log/security", f, "*", "*", "*") cfline("auth.info;authpriv.info /var/log/auth.log", f, "*", "*", "*") cfline("mail.info /var/log/maillog", f, "*", "*", "*") cfline("cron.* /var/log/cron", f, "*", "*", "*") cfline("*.=debug /var/log/debug.log", f, "-devd", "*", "*") cfline("*.emerg *", f, "-devd", "*", "*") cfline("daemon.info /var/log/daemon.log", f, "-devd", "*", "*") Trying to include files in '/etc/syslog.d' reading /etc/syslog.d/ftp.conf cfline("ftp.info /var/log/xferlog", f, "*", "*", "*") reading /etc/syslog.d/lpr.conf cfline("lpr.info /var/log/lpd-errs", f, "*", "*", "*") Trying to include files in '/usr/local/etc/syslog.d' Unable to open '/usr/local/etc/syslog.d': No such file or directory 4 3 2 3 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 X UNUSED: 7 5 2 5 5 5 6 3 5 5 X 5 5 5 5 5 5 5 5 5 5 5 5 5 X FILE: /var/log/messages X X X X X X X X X X X X X 7 X X X X X X X X X X X FILE: /var/log/security X X X X 6 X X X X X 6 X X X X X X X X X X X X X X FILE: /var/log/auth.log X X 6 X X X X X X X X X X X X X X X X X X X X X X FILE: /var/log/maillog X X X X X X X X X 7 X X X X X X X X X X X X X X X FILE: /var/log/cron 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 X FILE: /var/log/debug.log (-devd) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 X WALL: (-devd) X X X 6 X X X X X X X X X X X X X X X X X X X X X FILE: /var/log/daemon.log (-devd) X X X X X X X X X X X 6 X X X X X X X X X X X X X FILE: /var/log/xferlog X X X X X X 6 X X X X X X X X X X X X X X X X X X FILE: /var/log/lpd-errs logmsg: pri 56, flags 0, from test, msg restart syslogd: restarted logmsg: pri 6, flags 0, from test, msg kernel boot file is /boot/kernel/kernel Logging to FILE /var/log/messages kernel boot file is /boot/kernel/kernel received sa_len = 16 logmsg: pri 43, flags 0, from test, msg open /dev/nmdm12A: No such file or directory Logging to UNUSED Logging to FILE /var/log/messages Logging to FILE /var/log/auth.log So for some reason, HEAD version works for me!? Regarding the default syslogd_flags: Do you suggest to remove the syslogd_flags definition from defaults/rc.conf and auto-define the '-ss' resp. '-s' flags in /etc/rc.d/syslogd, keeping today's default '-s' behaviour? Since we 'include' config files from various places, I'd parse cfline from debug output if the '-s' _and_ '-ss' flags shall/must be preserved. What standards would be broken if we simply interpret default (no flags) as what today's '-ss' means and an additional -U flag (for UDP, -[rR] were free too) is required to enable receiving remote syslog datagrams (which is what today's no-flags default is), so the effect of '-s' won't change (besides invisibly auto-enabling -U). I guess '-s' would then be required to make @remotehost rules (sending to remote) work... but wherever I'm confronted with remote logging, rsyslogd(8) is dong that job (default on all Linux distributions). Nevertheless, I think an auto '-s' function would be required if changing the default behaviour is an option at all, so existing configs specifying remote-host log destinations still work out of box.
(In reply to Harald Schmalzbauer from comment #10) Please excuse my tangled questioning regarding the '-ss' default. Hopefully a better options outline: - auto-demote default/rc.conf '-ss' definition to '-s' in case any config defines @remote destination - auto-promoting to '-s' behaviour inside syslodg(8) in case config has @remote destination and making '-ss' the default in syslogd(8) itself, so 'syslogd_flags=' can be removed from defaults/rc.conf For the latter - which I would prefer - we'd need to establish an additional/new flag to provide today's default syslogd(8) behaviour (which isn't the actual default as long as user overrides syslogd_flags="" in rc.conf)
(In reply to Harald Schmalzbauer from comment #10) I'm not sure what that diff is. Here is my experiment, on main: # jail -c name=test exec.start=sh # syslogd -P /tmp/syslogd.pid -ss -dv can't open /dev/klog (16) getaddrinfo failed for syslog: Name does not resolve logmsg: pri 53, flags 0, from , msg getaddrinfo failed for syslog: Name does not resolve Logging to UNUSED # echo $? 1 With my syslogd patch: # syslogd -P /tmp/syslogd.pid -ss -dv can't open /dev/klog (16) Trying peer: /var/run/log new socket fd is 5 listening on socket sending on socket Trying peer: /var/run/logpriv new socket fd is 7 listening on socket sending on socket off & running.... ...
(In reply to Mark Johnston from comment #12) > I'm not sure what that diff is. The diff I mentioned is just a local MFC of syslogd(8). All changes up to d556719e15d6 (plus your test). I suspect devfs(8) makes the difference that your test fails (creating a jail by 'jail(8) -c') while my test succeeds (created a jail by 'start'ing /etc/rc.d/jail, without vnet.new or any ip[46].addr). But I haven't tried to dig deeper to track the root cause. Since your test case isn't solved in main's syslogd(8) version, the patch is apparently needed to cover minimal jails too. MFCing all in one is highly appreciated :-) Thanks a lot!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5d045d556b1cfeb1487d49017b536afb3df105d3 commit 5d045d556b1cfeb1487d49017b536afb3df105d3 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-09-19 10:00:33 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-09-19 10:01:37 +0000 syslogd: Ignore getaddrinfo() errors if -ss is specified This can arise if the jail doesn't have networking configured, and if -ss is specified, syslogd won't listen on port 514 anyway. Add a regression test case for this as well. PR: 238006 MFC after: 1 month usr.sbin/syslogd/syslogd.c | 8 ++++++++ usr.sbin/syslogd/tests/syslogd_test.sh | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9c0455e4c43a8123bd7965125d34273c5b3d9eaf commit 9c0455e4c43a8123bd7965125d34273c5b3d9eaf Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-09-19 10:00:33 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-10-19 12:55:03 +0000 syslogd: Ignore getaddrinfo() errors if -ss is specified This can arise if the jail doesn't have networking configured, and if -ss is specified, syslogd won't listen on port 514 anyway. Add a regression test case for this as well. PR: 238006 MFC after: 1 month (cherry picked from commit 5d045d556b1cfeb1487d49017b536afb3df105d3) usr.sbin/syslogd/syslogd.c | 8 ++++++++ usr.sbin/syslogd/tests/syslogd_test.sh | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9ecbda844643f19aba4c1652b2f9db7c8427d336 commit 9ecbda844643f19aba4c1652b2f9db7c8427d336 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-09-19 10:00:33 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-10-19 13:17:51 +0000 syslogd: Ignore getaddrinfo() errors if -ss is specified This can arise if the jail doesn't have networking configured, and if -ss is specified, syslogd won't listen on port 514 anyway. Add a regression test case for this as well. PR: 238006 MFC after: 1 month (cherry picked from commit 5d045d556b1cfeb1487d49017b536afb3df105d3) usr.sbin/syslogd/syslogd.c | 8 ++++++++ usr.sbin/syslogd/tests/syslogd_test.sh | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)