NetBSD Problem Report #59455

From www@netbsd.org  Mon Jun  2 20:27:56 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 15D6C1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  2 Jun 2025 20:27:56 +0000 (UTC)
Message-Id: <20250602202754.771B41A923E@mollari.NetBSD.org>
Date: Mon,  2 Jun 2025 20:27:54 +0000 (UTC)
From: aaron@zadzmo.org
Reply-To: aaron@zadzmo.org
To: gnats-bugs@NetBSD.org
Subject: Syslog silently discards log messaages if /var/log/messages is missing
X-Send-Pr-Version: www-1.0

>Number:         59455
>Category:       bin
>Synopsis:       Syslog silently discards log messaages if /var/log/messages is missing
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 02 20:30:01 +0000 2025
>Last-Modified:  Thu Jun 05 14:50:02 +0000 2025
>Originator:     Aaron
>Release:        NetBSD 9.1/amd64
>Organization:
>Environment:
NetBSD obscene 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I noticed ( in May 2025 ) logging to /var/log/messages on a machine had stopped on Dec 5th 2024.

Ultimately the cause is that /var/log/messages was missing. I had expected syslogd would automatically create log files as needed.

>How-To-Repeat:
Remove /var/log/messages and restart syslogd with -d, output is:

Running 'syslogd -d' I was able to see:

2025-06-02T15:58:25.950700-04:00:/usr/src/usr.sbin/syslogd/syslogd.c:read_config_file:3169      read_config_file()
2025-06-02T15:58:25.951693-04:00:/usr/src/usr.sbin/syslogd/syslogd.c:cfline:3736        cfline(4, "*.info;auth,authpriv,cron,ftp,kern,lpr,mail.none     /var/log/messages", f, "*", "*")
2025-06-02T15:58:25.953829-04:00:/usr/src/usr.sbin/syslogd/syslogd.c:logerror:2882      /var/log/messages: No such file or directory

Syslog starts and operats normally, but silently discards output that should go to /var/log/messages. 

>Fix:
'touch /var/log/messages' and '/etc/rc.d/syslogd restart' fixed the issue this time.

I think syslogd should automatically create log files at startup/reload as necessary.

If there are valid reasons this cannot be done, at least provide some signal to the administrator that there is a problem. For example, outputting "/var/log/messages: No such file or directory" before syslog daemonizes would at least greatly reduce time to troubleshoot.

>Audit-Trail:
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/59455: Syslog silently discards log messaages if
 /var/log/messages is missing
Date: Tue, 3 Jun 2025 14:33:55 -0400

 --Apple-Mail=_C418E2C4-E48F-41E3-960E-BACDDE47B912
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Perhaps log with LOG_CONS or LOG_PERROR, each file open failure?

 christos


 --Apple-Mail=_C418E2C4-E48F-41E3-960E-BACDDE47B912
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCaD9AEwAKCRBxESqxbLM7
 OvTyAKC0CHoZ++iJZ5t47mhx1sgITptFhQCghiO4dD4MRnBW4JKoy2B2b48hZdM=
 =Gnul
 -----END PGP SIGNATURE-----

 --Apple-Mail=_C418E2C4-E48F-41E3-960E-BACDDE47B912--

From: Christoph Badura <bad@bsd.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59455: Syslog silently discards log messaages if
 /var/log/messages is missing
Date: Wed, 4 Jun 2025 10:08:33 +0200

 On Tue, Jun 03, 2025 at 02:33:55PM -0400, Christos Zoulas wrote:
 > Perhaps log with LOG_CONS or LOG_PERROR, each file open failure?

 I wouldn't want the console to be spammed for every attempt to open the
 missing files.  Wouldn't that happen for every message that is supposed be
 written to said file?

 Likewise: where does syslogd's stderr point to?

 It appears to me that syslogd(8) and syslog.conf(5) do not contain any text
 mentioning that syslogd will not create missing files.  Perhaps we should
 just mention that in syslogd(8).  Maybe at the start of DESCRIPTION even.
 Or in CAVEATS.

 --chris

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59455: Syslog silently discards log messaages if /var/log/messages is missing
Date: Wed, 4 Jun 2025 11:40:44 -0000 (UTC)

 gnats-admin@NetBSD.org ("Christoph Badura via gnats") writes:

 > just mention that in syslogd(8).  Maybe at the start of DESCRIPTION even.
 > Or in CAVEATS.

 OpenBSD has it in CAVEATS.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59455 CVS commit: src/usr.sbin/syslogd
Date: Thu, 5 Jun 2025 10:47:13 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Jun  5 14:47:13 UTC 2025

 Modified Files:
 	src/usr.sbin/syslogd: syslogd.8

 Log Message:
 PR/59455: Aaron: Added CAVEATS section from OpenBSD about syslogd not creating
 files, but only logging to existing files.


 To generate a diff of this commit:
 cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/syslogd/syslogd.8

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 aaron@zadzmo.org
Subject: Re: bin/59455: Syslog silently discards log messaages if
 /var/log/messages is missing
Date: Thu, 5 Jun 2025 10:47:32 -0400

 --Apple-Mail=_DD166FE1-9C08-4A76-B56F-E6E80131C26A
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8

 Did the same as OpenBSD.

 christos

 > On Jun 4, 2025, at 7:45=E2=80=AFAM, Michael van Elst via gnats =
 <gnats-admin@netbsd.org> wrote:
 >=20
 > The following reply was made to PR bin/59455; it has been noted by =
 GNATS.
 >=20
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: bin/59455: Syslog silently discards log messaages if =
 /var/log/messages is missing
 > Date: Wed, 4 Jun 2025 11:40:44 -0000 (UTC)
 >=20
 > gnats-admin@NetBSD.org ("Christoph Badura via gnats") writes:
 >=20
 >> just mention that in syslogd(8).  Maybe at the start of DESCRIPTION =
 even.
 >> Or in CAVEATS.
 >=20
 > OpenBSD has it in CAVEATS.
 >=20


 --Apple-Mail=_DD166FE1-9C08-4A76-B56F-E6E80131C26A
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCaEGuBAAKCRBxESqxbLM7
 Osy7AJ9GPdptrL/dj2asjnXfRF4bKN38IACgi/aPcH80eXdV4WYTt7q2mfv42xI=
 =3JM2
 -----END PGP SIGNATURE-----

 --Apple-Mail=_DD166FE1-9C08-4A76-B56F-E6E80131C26A--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.