Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Nov 2024 01:42:35 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 282639] newsyslog may "double rotate" logs with duplicate rules
Message-ID:  <bug-282639-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282639

            Bug ID: 282639
           Summary: newsyslog may "double rotate" logs with duplicate
                    rules
           Product: Base System
           Version: 14.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jeffpc@josefsipek.net

Recently, I set up a new jail to handle my email and so I wanted to increase
the number of rotated maillogs to 60 days (from the default 7).  I tried to be
clever by creating /usr/local/etc/newsyslog.conf.d/maillog.conf with the
following line in it:

/var/log/maillog                        640  60    *    @T00  JC

and I keeping the maillog entry in /etc/newsyslog.conf alone.

I assumed that the .d snippet would *override* the line from the main config
file.

What ended up happening was that *every* rotated maillog would look like:

# bzcat maillog.20241019T000000.bz2
Oct 19 00:00:00 smtp newsyslog[33052]: logfile turned over
Oct 19 00:00:00 smtp newsyslog[33052]: logfile turned over

I believe that what happened is that newsyslog rotated the log twice every
night - first based on the /etc/newsyslog.conf rule and then based on the
/usr/local/etc/newsyslog.conf.d/maillog.conf rule.  Since there were no log
messages from postfix during the few milliseconds between rotations, the log
only had the newsyslog markers when it got rotated for the second time and the
actual log contents from the first log rotation of the night got lost.

(I like timestamp-based log rotation, and so my /etc/crontab has `newsyslog -t
DEFAULT`.  It is possible that using the regular integer suffixes would have
resulted in every-other-log still containing the log messages from the day.  I
haven't tested it.)

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-282639-227>