Bug 160967

Summary: newsyslog(8) is not working
Product: Base System Reporter: Kirill <Iklopik>
Component: binAssignee: David Bright <dab>
Status: Open ---    
Severity: Affects Only Me CC: dab
Priority: Normal    
Version: 8.2-RELEASE   
Hardware: Any   
OS: Any   

Description Kirill 2011-09-24 05:10:01 UTC
# cat /etc/newsyslog | grep -v ^#
/var/log/all.log                        600  7     *    @T00  J
/var/log/amd.log                        644  7     100  *     J
/var/log/auth.log                       600  7     100  *     JC
/var/log/console.log                    600  5     100  *     J
/var/log/cron                           600  3     100  *     JC
/var/log/daily.log                      640  7     *    @T00  JN
/var/log/debug.log                      600  7     100  *     JC
/var/log/kerberos.log                   600  7     100  *     J
/var/log/lpd-errs                       644  7     100  *     JC
/var/log/maillog                        640  7     *    @T00  JC
/var/log/messages                       644  5     100  *     JC
/var/log/monthly.log                    640  12    *    $M1D0 JN
/var/log/pflog                          600  3     100  *     JB    /var/run/pflogd.pid
/var/log/ppp.log        root:network    640  3     100  *     JC
/var/log/security                       600  10    100  *     JC
/var/log/sendmail.st                    640  10    *    168   B
/var/log/weekly.log                     640  5     1    $W6D0 JN
/var/log/wtmp                           644  3     *    @01T05 B
/var/log/xferlog                        600  7     100  *     JC
/var/log/mpd.log                        600  100   50   *     ZC
/var/log/samba34/log.nmbd               644  50    500  *     ZC
/var/log/samba34/log.smbd               644  50    500  *     ZC
/var/log/samba34/log.swat               644  10    100  *     ZC
/var/log/samba34/log.winbindd           644  10    500  *     ZC
/var/log/samba34/log.winbindd-dc-connect        644   10   500  *   ZC

# ls -la /var/log

drwxr-xr-x   4 root   wheel         33 24 &#1089;&#1077;&#1085; 03:02 ./
drwxr-xr-x  24 root   wheel         24 23 &#1089;&#1077;&#1085; 20:09 ../
-rw-------   1 root   wheel    1625056 24 &#1089;&#1077;&#1085; 14:51 all.log
-rw-------   1 root   wheel      23881 24 &#1089;&#1077;&#1085; 14:12 auth.log
-rw-------   1 root   wheel     270784 24 &#1089;&#1077;&#1085; 14:50 cron
drwxr-xr-x   2 root   wheel          5 19 &#1089;&#1077;&#1085; 22:46 cups/
-rw-------   1 root   wheel       1444 23 &#1089;&#1077;&#1085; 08:10 debug.log
-rw-------   1 root   wheel       6464 24 &#1089;&#1077;&#1085; 03:02 dmesg.today
-rw-------   1 root   wheel        368 23 &#1089;&#1077;&#1085; 03:02 dmesg.yesterday
-rw-r--r--   1 root   wheel        218 23 &#1089;&#1077;&#1085; 20:09 inadyn.log
-rw-------   1 root   wheel        636 24 &#1089;&#1077;&#1085; 03:02 ipfw.today
-rw-------   1 root   wheel        692 23 &#1089;&#1077;&#1085; 03:02 ipfw.yesterday
-rw-r--r--   1 root   wheel      28056 24 &#1089;&#1077;&#1085; 14:12 lastlog
-rw-r--r--   1 root   wheel         59 17 &#1089;&#1077;&#1085; 05:10 lpd-errs
-rw-r-----   1 root   wheel     170074 24 &#1089;&#1077;&#1085; 14:00 maillog
-rw-r--r--   1 root   wheel     263681 24 &#1089;&#1077;&#1085; 14:42 messages
-rw-------   1 root   wheel        689 18 &#1089;&#1077;&#1085; 03:01 mount.today
-rw-------   1 root   wheel      87198 23 &#1089;&#1077;&#1085; 20:09 mpd.log
-rw-r--r--   1 mysql  mysql       4814 23 &#1089;&#1077;&#1085; 20:09 mysql.log
-rw-------   1 root   wheel          0 18 &#1089;&#1077;&#1085; 03:01 pf.today
-rw-r-----   1 root   network     2144  2 &#1103;&#1085;&#1074;  2005 ppp.log
drwxr-xr-x   3 root   wheel         12 24 &#1089;&#1077;&#1085; 14:11 samba34/
-rw-------   1 root   wheel     345297 24 &#1089;&#1077;&#1085; 14:51 security
-rw-r-----   1 root   wheel        728 24 &#1089;&#1077;&#1085; 14:00 sendmail.st
-rw-r-----   1 root   wheel          0  2 &#1103;&#1085;&#1074;  2005 sendmail.st.0
-rw-r-----   1 root   wheel          0 17 &#1089;&#1077;&#1085; 07:00 sendmail.st.1
-rw-r-----   1 root   wheel          0 17 &#1089;&#1077;&#1085; 06:00 sendmail.st.2
-rw-r-----   1 root   wheel          0 18 &#1092;&#1077;&#1074;  2011 sendmail.st.3
-rw-------   1 root   wheel       4039 23 &#1089;&#1077;&#1085; 03:02 setuid.today
-rw-------   1 root   wheel       4039 20 &#1089;&#1077;&#1085; 03:01 setuid.yesterday
-rw-------   1 root   wheel       1491 22 &#1089;&#1077;&#1085; 20:35 userlog
-rw-r--r--   1 root   wheel       5104 24 &#1089;&#1077;&#1085; 14:12 wtmp
-rw-------   1 root   wheel         59 17 &#1089;&#1077;&#1085; 05:10 xferlog

# newsyslog -n -v -F /var/log/mpd.log
/var/log/mpd.log <100Z>: size (Kb): 86 [50] --> trimming log....
        rm -f /var/log/mpd.log.100
        rm -f /var/log/mpd.log.100.gz
        rm -f /var/log/mpd.log.100.bz2
        ln /var/log/mpd.log /var/log/mpd.log.0
        chmod 600 /var/log/mpd.log.0
Start new log...
        mktemp /var/log/mpd.log.zXXXXXX
        chmod 600 /var/log/mpd.log.zXXXXXX
        mv /var/log/mpd.log.zXXXXXX /var/log/mpd.log
Signal all daemon process(es)...
        kill -1 7697            # /var/run/syslog.pid
        sleep 10
Compress all rotated log file(s)...
        gzip /var/log/mpd.log.0
        chmod 600 /var/log/mpd.log.0.gz
# ls -la /var/log | grep mpd
-rw-------   1 root   wheel      87198 23 &#1089;&#1077;&#1085; 20:09 mpd.log
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:40 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 David Bright freebsd_committer 2019-02-08 13:45:04 UTC
I'm not sure what issue is being reported. Is it that after newsyslog is run:
 
  # newsyslog -n -v -F /var/log/mpd.log

that it shows a (compressed) rotated file being created:

  Compress all rotated log file(s)...
          gzip /var/log/mpd.log.0
          chmod 600 /var/log/mpd.log.0.gz

Yet when the log directory is listed that rotated file is not shown?

  # ls -la /var/log | grep mpd
  -rw-------   1 root   wheel      87198 23 &#1089;&#1077;&#1085; 20:09 mpd.log

If so, this is expected behavior. The -n flag is specified on this invocation, which causes a "dry run" of newsyslog; it prints what it would do in the rotation, but doesn't actually do it.