logrotate ignore 'rotate' setting.

the 'rotate' setting in my logrotate configurations is being ignored when run from the crontab.

I have tested my configurations using the "-d" option, the rotation count is working when I do the test.

Here are my configuration settings, is there anything I am doing wrong?

# cat -n /etc/logrotate.conf

1  # see "man logrotate" for details
     2  # :! /usr/sbin/logrotate -d /etc/logrotate.conf
     3
     4  # packages drop log rotation information into this directory
     5  include /etc/logrotate.d
     6
     7  # rotate log files weekly
     8  weekly
     9
    10  # keep 4 weeks worth of backlogs
    11  rotate 4
    12
    13  # create new (empty) log files after rotating old ones
    14  create
    15
    16  # uncomment this if you want your log files compressed
    17  compress
    18
    19  # no packages own wtmp, or btmp -- we'll rotate them here
    20  /var/log/wtmp {
    21      missingok
    22      monthly
    23      create 0664 root utmp
    24      rotate 1
    25  }
    26
    27  /var/log/btmp {
    28      missingok
    29      monthly
    30      create 0664 root utmp
    31      rotate 1
    32  }
    33
    34  # system-specific logs may be configured here

# cat -n /etc/logrotate.d/syslog2

1  /var/log/local0notices {
     2    missingok
     3    rotate 12
     4    size 50M
     5    compress
     6    delaycompress
     7    notifempty
     8    create 640 root adm
     9    sharedscripts
    10    postrotate
    11       /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    12       /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    13    endscript
    14  }

In what way does it ignore it? What does it do and what should it do?

The logs rotate only up to the 4th file. I want to keep 12 instances of the file. I set 'rotate 12' in the stanza for the file.

When I run with -d, the output message summary reports
"(12 rotations)".

I suspect I have some conflicting settings that causes the rotation to fall back to the main setting of 4.

For how long has this been in production? Because your setting for syslog reads as "rotate the file when the size has reached 50M, and keep up to 12 rotations". It won't rotate weekly, and it won't rotate if the file hasn't yet reached the required size.

These settings have been in place for more than 6 months.

I considered the same situation the the size setting was an issue, and setup a test.

I created an entry called /etc/logrotate.d/testfrank to process a rotation on file /tmp/local0notices but with the same size and rotate settings otherwise:

and then I ran this short script, which creates 20 60M files in /tmp of the same name 'local0notices' and runs logrotate on them ...

for x in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ; do
  dd if=/dev/zero of=/tmp/local0notices bs=1024 count=60000
  ls -lh /tmp/local0notices
  /usr/sbin/logrotate -v /etc/logrotate.conf 
  ls -altr /tmp/local0notices*
done

the result of which is good, I see 12 files in /tmp ...

The test works fine.

What looks weird to me on the real files, besides there's only ever 4 versions when I am trying to maintain 12, is the size of the files. It looks suspicious like another configuration setting may be processing the files before they're reaching 50M, the 433045 should be 50M or more.
I'm also not sure about the file name ending with .0 My test script didn't create a .0 file? ...:

My suspicions where correct ... My issue was that there were two procedures effecting this files, logrotate and cron.weekly/sysklogd using syslogd-listfiles --weekly command. I was able to filter out my local0notices file from the sysklogd procedure so that only logrotate managed my logs (at least for this logfile). Thanks to those who took a stab at resolving. I appreciate your help.