Discussion:
Bug#857891: [logrotate does not rotate logs]
LACROIX Jean Marc
2017-03-16 07:29:11 UTC
Permalink
Package: logrotate
Version: 3.8.7-1+b1
Severity: grave

Dear Maintainer,

I run logrotate on Jessie 8.7 on amd64 platform.

My initials conditions are :

***@srv-syslog-2:~# df -h
Filesystem Size Used Avail Use%
Mounted on
/dev/mapper/vg_data-srv_syslog_2_lv_rootfs 380M 52M 309M 15% /
/dev/mapper/vg_data-srv_syslog_2_lv_usr 477M 358M 95M 80% /usr
/dev/mapper/vg_data-srv_syslog_2_lv_var 283M 158M 111M 59% /var
/dev/mapper/vg_data-srv_syslog_2_lv_local_home 47M 1.7M 43M 4%
/local_home
/dev/mapper/vg_data-srv_syslog_2_lv_tmp 93M 1.7M 87M 2% /tmp
/dev/mapper/vg_data-srv_syslog_2_lv_var_log 11G 5.4G 4.2G 57%
/var/log
tmpfs 596M 68K 596M 1% /run
tmpfs 5.0M 0 5.0M 0%
/run/lock
tmpfs 3.2G 0 3.2G 0%
/run/shm

my config file /etc/logrotate.d/monit

/var/log/monit.log
{
rotate 4
weekly
minsize 1M
size 10000000
missingok
create 640 root adm
notifempty
compress
delaycompress
postrotate
invoke-rc.d monit reload > /dev/null
endscript
daily
}

The current configuration in /var/log/monit*

***@srv-syslog-2:~# ls -altrh /var/log/monit.log*
-rw-r----- 1 root adm 209K Feb 24 14:17 /var/log/monit.log.2.gz
-rw-r----- 1 root adm 6.2M Feb 26 00:17 /var/log/monit.log.1
-rw-r--r-- 1 root root 168M Mar 16 07:22 /var/log/monit.log

***@srv-syslog-2:~# /usr/sbin/logrotate -d -v -f /etc/logrotate.d/monit
reading config file /etc/logrotate.d/monit

Handling 1 logs

rotating pattern: /var/log/monit.log
forced from command line (4 rotations)
empty log files are not rotated, only log files >= 1048576 bytes are
rotated, old logs are removed
considering log /var/log/monit.log
log needs rotating
rotating log /var/log/monit.log, log->rotateCount is 4
dateext suffix '-20170316'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/monit.log.4.gz to /var/log/monit.log.5.gz (rotatecount
4, logstart 1, i 4),
renaming /var/log/monit.log.3.gz to /var/log/monit.log.4.gz (rotatecount
4, logstart 1, i 3),
renaming /var/log/monit.log.2.gz to /var/log/monit.log.3.gz (rotatecount
4, logstart 1, i 2),
renaming /var/log/monit.log.1.gz to /var/log/monit.log.2.gz (rotatecount
4, logstart 1, i 1),
renaming /var/log/monit.log.0.gz to /var/log/mognit.log.1.gz
(rotatecount 4, logstart 1, i 0),
renaming /var/log/monit.log to /var/log/monit.log.1
creating new /var/log/monit.log mode = 0640 uid = 0 gid = 4
running postrotate script
running script with arg /var/log/monit.log: "
invoke-rc.d monit reload > /dev/null
"
removing old log /var/log/monit.log.5.gz
error: error opening /var/log/monit.log.5.gz: No such file or directory


...and after run, of course, no change

***@srv-syslog-2:~# ls -altrh /var/log/monit.log*
-rw-r----- 1 root adm 209K Feb 24 14:17 /var/log/monit.log.2.gz
-rw-r----- 1 root adm 6.2M Feb 26 00:17 /var/log/monit.log.1
-rw-r--r-- 1 root root 168M Mar 16 07:23 /var/log/monit.log



Many thanks in advance for your help
Best regards
--
--------------------------------------
-- Jean-Marc LACROIX --
-- mailto : ***@free.fr --
---------------------------------------
Andreas Henriksson
2017-03-20 20:14:39 UTC
Permalink
Control: fixed -1 3.11.0-0.1
Control: tags -1 + jessie

Hello LACROIX Jean Marc,

[Sorry, but resending with fixed CC address this time.]

Thanks for your bug report. I've looked into the behaviour on sid/unstable
(which has the same version as stretch/testing, but not as jessie/stable).

I'm not able to reproduce your problem. Would be great if you have a
chance to see if you can reproduce the problem under stretch/testing.

Some notes about observations inline below.
Post by LACROIX Jean Marc
Package: logrotate
Version: 3.8.7-1+b1
Severity: grave
Dear Maintainer,
I run logrotate on Jessie 8.7 on amd64 platform.
Filesystem Size Used Avail Use%
Mounted on
/dev/mapper/vg_data-srv_syslog_2_lv_rootfs 380M 52M 309M 15% /
/dev/mapper/vg_data-srv_syslog_2_lv_usr 477M 358M 95M 80% /usr
/dev/mapper/vg_data-srv_syslog_2_lv_var 283M 158M 111M 59% /var
/dev/mapper/vg_data-srv_syslog_2_lv_local_home 47M 1.7M 43M 4%
/local_home
/dev/mapper/vg_data-srv_syslog_2_lv_tmp 93M 1.7M 87M 2% /tmp
/dev/mapper/vg_data-srv_syslog_2_lv_var_log 11G 5.4G 4.2G 57%
/var/log
tmpfs 596M 68K 596M 1% /run
tmpfs 5.0M 0 5.0M 0%
/run/lock
tmpfs 3.2G 0 3.2G 0%
/run/shm
my config file /etc/logrotate.d/monit
/var/log/monit.log
{
rotate 4
weekly
minsize 1M
size 10000000
(The above (size) line is not part of the shipped logrotate settings.)
Post by LACROIX Jean Marc
missingok
create 640 root adm
notifempty
compress
delaycompress
postrotate
invoke-rc.d monit reload > /dev/null
endscript
daily
Hmm, using both "daily" and "weekly" at the same time can't be
a sane configuration?!

(This daily line is also a deviation from the shipped monit logrotate
configuration.)
Post by LACROIX Jean Marc
}
The current configuration in /var/log/monit*
-rw-r----- 1 root adm 209K Feb 24 14:17 /var/log/monit.log.2.gz
-rw-r----- 1 root adm 6.2M Feb 26 00:17 /var/log/monit.log.1
-rw-r--r-- 1 root root 168M Mar 16 07:22 /var/log/monit.log
reading config file /etc/logrotate.d/monit
Handling 1 logs
rotating pattern: /var/log/monit.log
forced from command line (4 rotations)
empty log files are not rotated, only log files >= 1048576 bytes are
rotated, old logs are removed
considering log /var/log/monit.log
log needs rotating
rotating log /var/log/monit.log, log->rotateCount is 4
dateext suffix '-20170316'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/monit.log.4.gz to /var/log/monit.log.5.gz (rotatecount 4,
logstart 1, i 4),
renaming /var/log/monit.log.3.gz to /var/log/monit.log.4.gz (rotatecount 4,
logstart 1, i 3),
renaming /var/log/monit.log.2.gz to /var/log/monit.log.3.gz (rotatecount 4,
logstart 1, i 2),
renaming /var/log/monit.log.1.gz to /var/log/monit.log.2.gz (rotatecount 4,
logstart 1, i 1),
renaming /var/log/monit.log.0.gz to /var/log/mognit.log.1.gz (rotatecount 4,
logstart 1, i 0),
Even after adding your monit logrotate configuration deviations I get this here:

log /var/log/monit.log.5.gz doesn't exist -- won't try to dispose of it
Post by LACROIX Jean Marc
renaming /var/log/monit.log to /var/log/monit.log.1
creating new /var/log/monit.log mode = 0640 uid = 0 gid = 4
running postrotate script
running script with arg /var/log/monit.log: "
invoke-rc.d monit reload > /dev/null
"
removing old log /var/log/monit.log.5.gz
error: error opening /var/log/monit.log.5.gz: No such file or directory
...and after run, of course, no change
-rw-r----- 1 root adm 209K Feb 24 14:17 /var/log/monit.log.2.gz
-rw-r----- 1 root adm 6.2M Feb 26 00:17 /var/log/monit.log.1
-rw-r--r-- 1 root root 168M Mar 16 07:23 /var/log/monit.log
Many thanks in advance for your help
The missing output line and comparing the code from the Jessie version:

/* if the last rotation doesn't exist, that's okay */
if (!debug && rotNames->disposeName
&& access(rotNames->disposeName, F_OK)) {
message(MESS_DEBUG,
"log %s doesn't exist -- won't try to " "dispose of it\n",
rotNames->disposeName);
free(rotNames->disposeName);
rotNames->disposeName = NULL;
}

.. and the stretch version:

/* if the last rotation doesn't exist, that's okay */
if (rotNames->disposeName && access(rotNames->disposeName, F_OK)) {
message(MESS_DEBUG,
"log %s doesn't exist -- won't try to dispose of it\n",
rotNames->disposeName);
free(rotNames->disposeName);
rotNames->disposeName = NULL;
}

Please note that the !debug condition has been dropped, which seems
correct to me.

I thus very much suspect this is an already fixed bug.

Regards,
Andreas Henriksson
Alessandro Vesely
2017-07-29 11:31:30 UTC
Permalink
Post by Andreas Henriksson
[...]
I thus very much suspect this is an already fixed bug.
So is this bug confirmed?

TIA
Ale

Loading...